Skip to main content

Property can be auto-implemented

In This Article

CodeRush Classic shows the Property can be auto-implemented code issue if a property with a backing store has simple accessors.

#Fix

Convert the property with a backing store to an auto-implemented property.

#Purpose

Highlights the properties with a backing store that can be auto-implemented to improve code readability.

#Example

private string _MyProperty;
public string MyProperty
{
    get
    {
        return _MyProperty; 
    }
    set
    {
        _MyProperty = value;
    }
}

Fix:

public string MyProperty { get; set; }