Used to remove a private class member (field, property, method, event, etc.), which is never used.
Available when the cursor is on the member name, providing this member is never assigned or referenced.
-
Place the caret on an unused member name.
Note
The blinking cursor shows the caret's position at which the Refactoring is available.
C# |
public class Person {
private int CustomerID;
public string FirstName { get; set; }
public string LastName { get; set; }
}
|
VB |
Public Class Person
Private CustomerID As Integer
Public Property FirstName() As String
Public Property LastName() As String
End Class
|
- Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
- Select Remove Unused Member from the menu.
After execution, the Refactoring removes the member.
C# |
public class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
}
|
VB |
Public Class Person
Public Property FirstName() As String
Public Property LastName() As String
End Class
|