Add Getter

Adds a getter to a write-only property, and selects the contents of this getter.

Availability

From the context menus or via shortcuts:

  • when the edit cursor or caret is on a property name within its declaration, provided that the property does not contain a getter.

Example

private int _TestProperty;
public int TestProperty
{
    set
    {
        _TestProperty = value
    }
}
Private _TestProperty As Integer
Public ReadOnly Property TestProperty() As Integer
    Set(ByVal value As Integer)
        _TestProperty = value;
    End Get
End Property

Result:

private int _TestProperty;
public int TestProperty
{
    get
    {return _TestProperty;
    }
    set
    {
        _TestProperty = value;
    }
}
Private _TestProperty As Integer
Public Property TestProperty() As Integer
    GetReturn _TestProperty
    End Get
    Set(ByVal value As Integer)
        _TestProperty = value
    End Set
End Property