Replace with Alias
In This Article
Expands the alias at the caret.
#Availability
Available from the context menu or via shortcuts:
- when the edit cursor or caret is on a type or namespace alias.
#Notes
- This refactoring is the opposite of Introduce Alias .
- This refactoring doesn’t remove the alias, even if there are no references left to it.
#Example
using System;
using MyAlias = System.Windows.Forms.Button;
namespace MyApplication
{
class TestClass
{
private MyAlias TestMethod()
{│MyAlias MyBtn = new MyAlias();
return MyBtn;
}
}
}
Imports MyAlias = System.Windows.Forms.Button
Namespace MyApplication
Class TestClass
Private Function TestMethod() As MyAlias
Dim MyBtn As │MyAlias = New MyAlias()
Return MyBtn
End Function
End Class
End Namespace
Result:
using System;
using MyAlias = System.Windows.Forms.Button;
namespace MyApplication
{
class TestClass
{
private MyAlias TestMethod()
{│System.Windows.Forms.Button MyBtn = new MyAlias();
return MyBtn;
}
}
}
Imports MyAlias = System.Windows.Forms.Button
Namespace MyApplication
Class TestClass
Private Function TestMethod() As MyAlias
Dim MyBtn As │System.Windows.Forms.Button = New MyAlias()
Return MyBtn
End Function
End Class
End Namespace
#Screenshot
See Also