Skip to main content

Remove Setter

In This Article

Removes the setter accessor from the current property.

#Availability

From the context menus or via shortcuts:

  • when the edit cursor or caret is on the property declaration.
  • when the edit cursor or caret is on the set keyword.

Note

The code provider is available only if the setter accessor is never referenced.

#Example

private int _MyProperty;
public int MyProperty
{
    get
    {
        return _MyProperty;
    }
    set
    {
        _MyProperty = value;
    }
}
Private _MyProperty As Integer
Public Property MyProperty()
    Get
        Return _MyProperty
    End Get
    Set(ByVal value)
        _MyProperty = value
    End Set
End Property

Result:

private int _MyProperty;
public int MyProperty
{
    get
    {
        return _MyProperty;
    }
}
Private _MyProperty As Integer
Public ReadOnly Property MyProperty() As Object
    Get
        Return _MyProperty
    End Get
End Property