resharper 表达式正文格式

resharper expression body format

我正在尝试让 Resharper 像这样格式化表达式主体 getter 和设置器。

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

但是,当我 运行 代码清理时,它将 属性 重新格式化为

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

我发现它的可读性较差,因为它将我的代码推离了屏幕

问题

我需要在 ReSharper 中调整哪些设置或其组合,以便 ReShaper 重新格式化我的代码以使其看起来像第一个示例?

正确答案:

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

原答案:

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