Search code examples
c#namespacesusing

C# using every namespace in the project


In each my .cs file I have tons of "using" lines including other namespaces, like that:

using Game.Models.Main;
using Game.Models.DataStore;
using Game.Manager.MapManager;
using Game.Network.Player;

What if in the beginning of every new .cs file I include "using" statements for all existing namespaces in my code? Are there any downsides of that? Like performance or anything I can't think of?

Why I want that: in Eclipse you can press Ctrl+Space and you'll see the list of definitions starting with the typed characters. In Visual Studio however, you can see that only if the class you're typing is among the "using" namespaces. So when you write a new class you have to type every other class name in full.


Solution

  • It would probably slow down visual studio's intellisense, but as for a compiled product, it would not affect the resulting binary by having superfluous using statements.

    If you want to remove superfluous using statements then you can right-click on the using statements, and go to "refactor" > "sort and remove"