Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the spacing behaviour in Resharper to multi-line lambda in-the-spot expressions

How to convert the ugly

Task t1 = new Task(() => {
                        for (int i = 0; i < int.MaxValue; ++i) {
                            Console.WriteLine(i);
                        }
                    });

to something more palatable, such as

Task t1 = new Task(() => {
    for (int i = 0; i < int.MaxValue; ++i) {
        Console.WriteLine(i);
    }
});

in Resharper?

Thanks

like image 477
devoured elysium Avatar asked Dec 18 '25 02:12

devoured elysium


1 Answers

Go to ReSharper | Options -> Code Editing | C# | Formatting Style | Other, turn off Align Multiline Constructs | Anonymous method body. This is for ReSharper 7.1, maybe in previous versions you'd also need to look for some settings on the same page, but in Other section.

like image 145
Dmitry Osinovskiy Avatar answered Dec 19 '25 19:12

Dmitry Osinovskiy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!