我试图让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将我的代码重新格式化为第一个示例?
正确答案:
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