Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change the way ReSharper generates properties?

Tags:

resharper

Is it possible to change the way that Resharper formats properties?

I don't like:

public string Foo 
{
    get 
    {
        return bar;
    }
    set 
    {
        bar = value;
    }
}

I like:

public string Foo 
{
    get { return bar; }
    set { bar = value; }
}
like image 860
Carl Bergquist Avatar asked Oct 30 '09 13:10

Carl Bergquist


1 Answers

You sure can, just go to Resharper > Options > Languages > C# > Formatting Style and tick "place simple property/indexer/event declaration on a single line"

Updated for Resharper 8.2: Resharper > Options > Code Editing > C# > Formatting Style > Line Breaks and Wrapping > Other > Place simple property/indexer/event declaration on single line

like image 142
Rob Fonseca-Ensor Avatar answered Sep 29 '22 12:09

Rob Fonseca-Ensor