|
Project
|
ReSharper
|
|
Priority
|
Normal |
|
Type
|
Feature |
|
Fix versions
|
Mirabile Futurum |
|
State
|
Open |
|
Assignee
|
Evgeny Pasynkov |
|
Subsystem
|
Psi |
|
Affected versions
|
No Affected versions |
|
Fixed in build
|
No Fixed in build
|
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;
using System; using System.Collections;
If there are more than one element of the qualified name has to be specified then the replacement of the aliased types dramatically reduces the readablity of the code.
Example:
using MyEnum = MyNamespaceOne.MyNamespaceTwo.MyAnotherType.MyNestedType.MyEnum;
namespace MyNamespaceOne.MyNamespaceTwo
{
class MyType
{
class MyNestedType
{
void Foo()
{
MyEnum a = MyEnum.Member;
}
}
}
}
Would be replaced with:
namespace MyNamespaceOne.MyNamespaceTwo
{
class MyType
{
class MyNestedType
{
private enum MyEnum { ... };
void Foo()
{
MyAnotherType.MyNestedType.MyEnum a = MyAnotherType.MyNestedType.MyEnum.Member;
}
}
}
}
The workaround is to use the different name for the alias and uncheck "Do not remove using alias directives if alias name differs from teh imported type name" in ReSharper > Options > C# > Namespaces Imports :
using ImportedEnum = MyNamespaceOne.MyNamespaceTwo.MyAnotherType.MyNestedType.MyEnum;
namespace MyNamespaceOne.MyNamespaceTwo
{
class MyType
{
class MyNestedType
{
void Foo()
{
ImportedEnum a = ImportedEnum.Member;
}
}
}
}
Although the latter won't be changed by refactoring but it reduces the readablity of the code too - so I voted for that ReSharper feature.