How is performance affected by an unused using directive?

Visual Studio will automatically create using statements for you whenever you create a new page or project. Some of these you will never use.

Visual Studio has the useful feature to "remove unused usings".

I wonder if there is any negative effect on program performance if the using statements which are never accessed, remain mentioned at the top of the file.


Solution 1:

An unused using has no impact to the runtime performance of your application.

It can affect the performance of the IDE and the overall compilation phase. The reason why is that it creates an additional namespace in which name resolution must occur. However these tend to be minor and shouldn't have a noticeable impact on your IDE experience for most scenarios.

It can also affect the performance of evaluating expressions in the debugger for the same reasons.

Solution 2:

No, it's just a compile-time/coding style thing. .NET binaries use fully qualified names under the hood.