我试图让 Resharper 像这样格式化表达式正文获取器和二传手。
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