Skip to main content

Declare Local (implicit)

In This Article

Generates an implicit local variable for the current reference.

Note

The code provider is only available for .NET framework 3.5 or higher.

#Availability

From the context menus or via shortcuts:

  • when the edit cursor or caret is on an undeclared variable reference.

#Example

private int TestMethod(int param)
{
    return param * multiplier;
}
Private Function TestMethod(ByVal Param As Integer) As Integer
    Return Param * Multiplier
End Function

Result:

private int TestMethod(int param)
{
    var multiplier = 0;
    return param * multiplier;
}
Private Function TestMethod(ByVal Param As Integer) As Integer
    Dim Multiplier = 0
    Return Param * Multiplier
End Function