The requested page is not available for the requested platform. You are viewing the content for Default platform.

Declare Field

Declares a field for an undeclared reference.

Availability

From the context menus or via shortcuts:

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

Example

private int TestMethod()
{
    return MyField * 2;
}
Private Function TestMethod() As Integer
    Return MyField * 2
End Function

Result:

private int MyField = 0;
private int TestMethod()
{
    return MyField * 2;
}
Private MyField As Integer = 0
Private Function TestMethod() As Integer
    Return MyField * 2
End Function