Shortcut for alphabetic order

Hi,

I'm looking for a function or shortcut to sort all properties, methods, enum values, etc in an alphabetic order. As far as I understand I can use some layout templates which do the job. But I appreciate that kind of functionality in the "File Structure" window e.g.. Just select the class or enum and click the "Sort" button (context menu works as well ;-) ).
Do I miss something?

Thanks
Alex

4 comments
Comment actions Permalink

Hello
     Such functionality (Reorder members) is available as part of the Code Cleanup feature (ReSharper > Code > Cleanup Code). The Full Cleanup profile includes this functionality by default, alternatively you can create your own custom profile under ReSharper > Options > Code Cleanup. You can set one of the profiles to be used during silent cleanup and then invoke it (Ctrl+Shift+Alt+F in ReSharper 2.x/IDEA scheme or Ctrl+E, F in Visual Studio scheme) when necessary. In order to fine-tune how members get sorted and organized, you can edit the pattern under ReSharper > Options > Languages > C# > Type Member Layout. Thank you!


Andrey Serebryansky

Support Engineer

JetBrains, Inc

http://www.jetbrains.com

"Develop with pleasure!"

0
Comment actions Permalink

Also have a look at http://www.rauchy.net/regionerate/.
(You can create custom templates not to use regions but simply group/sort members).

Works great together with resharper's file structure window (I use a keyboard shortcut macro which "regionates" the code and then performs tidy-up with Resharper).
Only drawback really is that if you have breakpoints in current file they will be deleted since the file layout changes.

*Edit-for-this-very-old-post: This is a stupid suggestion, using RS's type members layout is better.

0
Comment actions Permalink

How do you modify the Type Member Layout to achieve alphabetic sorting?

If my code use one region for each of these:

  • fields
  • properties
  • methods
  • constructors

I need each region to be sorted so that each object is sorted alphabetically?

How do I modify the Type Member Layout to do this?

Many thanks,

Karl

0
Comment actions Permalink

See <Match> (<Kind Is="..."/>), <Sort> (<Name/>) and <Group Region="my region"/>

0

Please sign in to leave a comment.