Make Explicit

Converts the implicitly-typed local variable to a variable with an explicit type.

Availability

Available from the context menu or via shortcuts:

  • when the caret is on an implicit variable declaration (the variable doesn't have a type explicitly declared, and it is initialized to a value of an integral type).
Note

This refactoring is only available in .NET Framework 3.0 or higher (C# or VB).

Notes

Example

var a = "Hello World";
Dim a = "Hello World"

Result:

string a = "Hello World";
Dim a As String = "Hello World"

Screenshot

rsMakeExplicit

See Also