How do I keep Resharper from massively indenting lambdas?

久未见 提交于 2019-11-30 16:30:39

问题


I have Resharper installed with mainly default settings. Currently, I'd like my multi-line lambda expressions to look something like this:

foobarclass.biz.baz.Event += (s, e) =>
  {
    foo.Bar.DoThings.Whatever();
  };

However, Resharper "helpfully" will reformat my code to be like this:

foobarclass.biz.baz.Event += (s, e) =>
                                 {
                                     foo.Bar.DoThings.Whatever();
                                 };

And in some cases, will also break up long statements so it ends up looking like this:

foobarclass.biz.baz.Event += (s, e) =>
                                 {
                                     foo.
                                        Bar.
                                        DoThings.
                                        Whatever();
                                 };

As you can tell, this auto-formatting makes code a lot less readable. How can I fix this kind of behavior?


回答1:


Try unchecking:

RESHARPER -> OPTIONS -> C# -> Formatting Style -> Other -> Indent Anonymous Method Body



来源:https://stackoverflow.com/questions/13846409/how-do-i-keep-resharper-from-massively-indenting-lambdas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!