简体   繁体   中英

resharper expression body format

I'm attempting to get Resharper to format expression body getter and setters like this.

public ApplicationUserManager UserManager
{
    get => _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
    private set => _userManager = value;
}

However, when I run code clean up it reformats the property to

public ApplicationUserManager UserManager { get => _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); private set => _userManager = value; }

Which I find less readable because it pushes my code off the screen

Question

What setting or combination thereof do I need to adjust in ReSharper such that ReShaper will reformat my code to look like the first example?

Correct Answer:

ReSharper -> Options -> Code Editing -> C# -> Formatting Style -> Line Breaks and Wrapping -> Arrangement of Declaration Blocks -> Place simple property/indexer/event declaration on single line = Unchecked

Original Answer:

ReSharper -> Options -> Code Editing -> C# -> Formatting Style -> Line Breaks and Wrapping -> Arrangement of Attributes -> Place accessor attribute on same line = Never

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM