2

Possible Duplicate:
Do the amount of namespaces affect performance?

When you create a new class in C#, the default template includes several using lines at the top for LINQ and a couple others. Does having the namespaces included cause the application use more resources at run-time?

I rarely use anything in the LINQ namespace and I want to make sure I'm not paying the price for something I'm not using if I leave the lines there.

Community
  • 1
  • 1
Booers
  • 351
  • 4
  • 8
  • 3
    Possible duplicate: http://stackoverflow.com/questions/4378972/do-the-amount-of-namespaces-affect-performance – sisve Dec 30 '10 at 20:22
  • This isn't an answer to your question, but on a related note: The excellent [PowerCommands for VS2010](http://visualstudiogallery.msdn.microsoft.com/en-us/e5f41ad9-4edc-4912-bca3-91147db95b99) extension adds a feature to Visual Studio that removes unused `using` directives when you save a source file. – Dan J Dec 30 '10 at 20:25

3 Answers3

1

Anything you include will require more resources, however, this should only slow down your compile or link time not your program's actual run time.

Christopher Peterson
  • 983
  • 7
  • 22
  • 32
0

No it does not affect them, but if you right click and go to organize usings -> remove and sort it will then get rid of any using you are not using.

Andrew Sehr
  • 342
  • 1
  • 4
  • 13
0

It will not have any runtime performance. It's purely used during the compilation period (to find appropriate classes).

By the time C# code is compiled into IL, namespaces themselves don't exist anyway.

Damien_The_Unbeliever
  • 234,701
  • 27
  • 340
  • 448