Make Member Static
In This Article
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
- This refactoring is the opposite of Make Member Non-static.
#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