The requested page is not available for the requested platform. You are viewing the content for Default platform.

Expand Setter (C#, C++)

Expands single-line setter code onto multiple lines.

Purpose

This refactoring is great if you plan to expand a property's setter body. With a single keystroke, you can reformat a single-line accessor declaration into a multiple line format. This will make it easier to start modifications.

Availability

Available from the context menus or via shortcuts:

  • when the caret is within a setter declaration. The setter should have a single-line format.

Example

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

Result:

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

Screenshot

rsExpandSetter

See Also