Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to remove empty regions with ReSharper cleanup?

Tags:

c#

resharper

I want ReSharper to remove empty regions on code cleanup.

#region

#endregion

Is there any setting?

like image 916
Dmitriy Dokshin Avatar asked Oct 19 '22 04:10

Dmitriy Dokshin


1 Answers

Edit -> Replace in Files (regular expression)

unnamed regions

#region[\r\n\t ]*#endregion

named regions

[ ]*#region \w*[\r\n\t ]*#endregion \w*[ ]*

Run a cleanup of your code afterwards to get rid of the empty lines

like image 173
Dmitriy Dokshin Avatar answered Oct 21 '22 23:10

Dmitriy Dokshin