Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reorder type members with Resharper?

Tags:

c#

resharper

Typical scenario: a class that a lot of people have worked on. I'd like to sort methods, properties, etc... in alphabetical order.

I'd like to be able to do this within the region or globally in the class.

I see the feature in Resharper to do it, but it does not seem to do anything.

like image 924
AngryHacker Avatar asked Sep 17 '09 17:09

AngryHacker


2 Answers

Use the "Cleanup Code" functionality.

The order of the members can be set up in the ReSharper options in Languages, C#, Type Members Layout. This is a well documented XML layout specification which ReSharper uses when reordering members.

like image 166
Lucero Avatar answered Sep 24 '22 13:09

Lucero


Sorting is not activated by default. You can activate it by opening the resharper options and then go here:

enter image description here

like image 32
jgauffin Avatar answered Sep 22 '22 13:09

jgauffin