resharper表达体格式

时间:2018-03-01 18:04:25

标签: c# resharper

我试图让Resharper格式化表达体getter和setter这样的格式。

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将我的代码重新格式化为第一个示例?

1 个答案:

答案 0 :(得分:2)

正确答案:

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

原始答案:

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