Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the benefits of maintaining a "clean" list of using directives in C#?

I know VS2008 has the remove and sort function for cleaning up using directives, as does Resharper. Apart from your code being "clean" and removing the problem of referencing namespaces which might not exist in the future, what are the benefits of maintaining a "clean" list of using directives?

Less code? Faster compilation times?

like image 899
Carl Avatar asked Oct 24 '08 21:10

Carl


1 Answers

If you always only have the using directives that you need, and always have them appropriately sorted, then when you come to diff two versions of the code, you'll never see irrelevant changes.

Furthermore, if you have a neat set of using directives then anyone looking at the code to start with can get a rough idea of what's going to be used just by look at the using directives.

like image 103
Jon Skeet Avatar answered Oct 02 '22 18:10

Jon Skeet