Optimize Usings shouldn't remove aliases

Because I've been burned so much in the Java world, I'm a big fan of using aliases instead of the using entire namespaces. For example:

using Array = System.Array;
using Hashtable = System.Collections.Hashtable;
using ICloneable = System.ICloneable;
using ICollection = System.Collections.ICollection;
using IEnumerable = System.Collections.IEnumerable;
using IEnumerator = System.Collections.IEnumerator;
using SerializableAttribute = System.SerializableAttribute;

rather than

using System;
using System.Collections;

The reason for this is so that I know EXACTLY what I'm using, especially when I'm only using a couple of classes in a namespace. I don't think that optimize usings should remove these aliases and replace them with the namespace.

I also hope that more and more C# developers will start using this method. Unfortunately, most sample code (as was the old days of Java) uses namespaces rather than classes. This would be made easier by automatically adding using alias statements for individual classes how IDEA does it.

Thanks,
Michael D. Norman
ProbuSoft, Inc.

1 comment
Comment actions Permalink

I think it's a feature and you can submit such request into the Tracker.

--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com "Develop with pleasure!"


Because I've been burned so much in the Java world, I'm a big fan of
using aliases instead of the using entire namespaces. For example:

using Array = System.Array;
using Hashtable = System.Collections.Hashtable;
using ICloneable = System.ICloneable;
using ICollection = System.Collections.ICollection;
using IEnumerable = System.Collections.IEnumerable;
using IEnumerator = System.Collections.IEnumerator;
using SerializableAttribute = System.SerializableAttribute;
rather than

using System;
using System.Collections;
The reason for this is so that I know EXACTLY what I'm using,
especially when I'm only using a couple of classes in a namespace. I
don't think that optimize usings should remove these aliases and
replace them with the namespace.

I also hope that more and more C# developers will start using this
method. Unfortunately, most sample code (as was the old days of Java)
uses namespaces rather than classes. This would be made easier by
automatically adding using alias statements for individual classes how
IDEA does it.

Thanks,
Michael D. Norman
ProbuSoft, Inc.


0

Please sign in to leave a comment.