开发者

ReSharper: formatting of delegates

开发者 https://www.devze.com 2022-12-21 01:06 出处:网络
I like my code formatted like this: WithDataContext.Execute( delegate(开发者_JAVA百科DataContext dataContext)

I like my code formatted like this:

WithDataContext.Execute(
    delegate(开发者_JAVA百科DataContext dataContext)
    {
        // code goes here.
    });

ReSharper wants to auto-format it like this:

WithDataContext.Execute(
                           delegate(DataContext dataContext)
                               {
                                   // code goes here.
                               });

What options do I need to tweak to get what I want?


ReSharper -> Options -> C# -> Formatting Style -> Braces Layout -> Anonymous method declaration

Set to "At next line (BSD style)"

ReSharper -> Options -> C# -> Formatting Style -> Other -> Align Multiline Constructs

Uncheck "Call Arguments" and you'll get what you're looking for.


There isn't an option to format quite like that that I can find, but take a look at ReSharper|Options: Languages|C#|Formatting Style|Braces Layout. It has a number of options like anonymous type format.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号