Make Member Static

Makes a member static and updates all references accordingly.

Availability

Available from the context menu or via shortcuts:

  • when the cursor is on a method declaration. The method shouldn't reference instance members of its class.

Notes

Examples

public int TestMethod(int a, int b)
{
    return a * (b + a);
}
Public Function TestMethod(ByVal a As Integer, ByVal b As Integer) As Integer
    Return a * (b + a)
End Function

Result:

public static int TestMethod(int a, int b)
{
    return a * (b + a);
}
Public Shared Function TestMethod(ByVal a As Integer, ByVal b As Integer) As Integer
    Return a * (b + a)
End Function

Screenshot

rsMakeMemberStatic