Remove Private Setter
In This Article
Removes a private property setter that simply assigns a value to a field without any side-effects.
#Availability
Available from the context menu or via shortcuts:
- when the edit cursor,or caret is on a private property setter, provided that the setter’s body contains only one field initializer.
Note
Is not available in C++.
#Example
private int _Id;
public int id
{
get
{
return _Id;
}│private set
{
_Id = value;
}
}
Private _Id
Public Property id()
Get
Return _Id
End Get│Private Set(ByVal value)
_Id = value
End Set
End Property
Result:
private int _Id;
public int id
{
get
{
return _Id;
}
}│
Private _Id
Public ReadOnly Property id() As Object
Get
Return _Id
End Get
End Property│