Is there any evidence that suggests including a whole namespace in c# slows things down?
Is it better to do this
System.IO.Path.Combine....
Or to include the whole System.IO namespace?开发者_开发技巧
It's much better to include the namespace in a using
statement at the top of your class. The compiler doesn't care; it will emit the same IL both ways, and your code will be shorter and easier to read.
No matter what, including the entire namespace will not slow down production code.
Will it slow down the compiler? That's debatable, but C# compilation is so fast it's unlikely. A far worse offender in slowing down compilation is a large number of projects in your solution.
It makes no difference... it's purely for readability and in cases where you have naming collisions.
It will not slow down your production code, however it could slow down your coding as the IDE has to show you more options and you have to pick through more possibilities when looking at code completion lists.
Adding extra namespaces can affect the compile time of your application. It's unlikely to be noticable in most applications but extremes could make it visible.
It however has no impact on the runtime performance of your application.
No, the compiler is fast enough. Not sure what else I can add :)
精彩评论