Skip to main content

Convert to Auto-implemented Property

Removes the backing store, and converts this property to an Auto-implemented Property.

#Availability

Available from the context menu or via shortcuts:

  • when the edit cursor or caret is on a property declaration statement. The property should have a simple getter that returns a field, value and a simple setter that assigns that field a value.

#Example

private string fPropertyA;

public string PropertyA {
    get { return fPropertyA; }
    set { fPropertyA = value; }
}
Private fPropertyA As String
Public Property PropertyA
    Get
        Return fPropertyA
    End Get
    Set(ByVal value)
        fPropertyA = value
    End Set
End Property

Result:

public string PropertyA { get; set; }
Public Property PropertyA() As Object

#Screenshot

rsConvertToAutoimplementedProperty