For example, I rarely need:
using System.Text;
but it's always there by default. I assume the application will use more memory if your code contains unnecessary using directives. But is there anything else I should be aware of?
Also, does it make any difference whatsoever if the same using directive is used in only one file vs. most/all files?
Edit: Note that this question is not about the unrelated concept called a using statement, designed to help one manage resources by ensuring that when an object goes out of scope, its IDisposable.Dispose method is called. See Uses of "using" in C#.
They are just used as a shortcut. For example, you'd have to write: System.Int32 each time if you did not have a using System; on top.
Removing unused ones just makes your code look cleaner.
Your application will not use more memory. Its for the compiler to find classes you use in the code files. It really doesnt hurt beyond not being clean.
if you want to maintain your code clean, not used
using
statements should be removed from the file. the benefits appears very clear when you work in a collaborative team that need to understand your code, think all your code must be maintained, less code = less work, the benefits are long term.Do not forget that the compiler do a lot of work to optimize everything when building your project. Using that is used in a lot of place or 1 shouldn't do a different once compiled.
There are few reasons for removing unused using(s)/namespaces, besides coding preference:
What removing the unused namespaces won't do:
The resulting assembly is the same with or without unused using(s) removed.
The using statement just keeps you from qualifying the types you use. I personally like to clean them up. Really it depends on how a loc metric is used