I often use guard statements to simplify my code and return quickly when an error occurs.
Now I would like to save some space by putting these statements into a single line by selecting the text and hit a key combination.
How can I achieve this?
As example:
if (!websiteValidationResult.IsSuccess)
{
GoToEditView(editWebsiteModel, websiteValidationResult.ErrorMessage);
}
Format to:
if (!websiteValidationResult.IsSuccess) { GoToEditView(editWebsiteModel, websiteValidationResult.ErrorMessage); }
Yes, you can do this with ReSharper. Go to: Code Editing | C# | Formatting Style | Line Breaks and Wrapping and select Force put on single line
for the Break line in a block with a single statement rule.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With