使用 ReSharper 格式化内联匿名类型以符合 StyleCop
Format inline anonymous type with ReSharper to be compliant with StyleCop
我有以下代码:
var newItems = items.Select(x => new { x.Id, x.Name });
ReSharper 将其重新格式化为:
var newItems = items.Select(x => new {x.Id, x.Name});
它给出了 StyleCop 警告 SA1012 and SA1013
我试过 this solution 但它似乎不适用于匿名类型。
我需要在 ReSharper 中修改什么设置才能确保重新格式化符合 StyleCop?
有一个选项可以确定预期的行为:
C# -> Formatting Style -> Spaces -> Within single-line initializer braces.
此外,您可能需要暂停并重新启动 Resharper 或重新启动 Visual Studio。
我有以下代码:
var newItems = items.Select(x => new { x.Id, x.Name });
ReSharper 将其重新格式化为:
var newItems = items.Select(x => new {x.Id, x.Name});
它给出了 StyleCop 警告 SA1012 and SA1013 我试过 this solution 但它似乎不适用于匿名类型。
我需要在 ReSharper 中修改什么设置才能确保重新格式化符合 StyleCop?
有一个选项可以确定预期的行为:
C# -> Formatting Style -> Spaces -> Within single-line initializer braces.
此外,您可能需要暂停并重新启动 Resharper 或重新启动 Visual Studio。