Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to quickly organize functions in source code (c#) to order by alphabetical order?

I'm doing some class clean to organize the functions in cs file in alphabetical order. I'm using Visual Studio 2008.

When writing them, I just put them arbitrarily, but it now looks quite messy.

Is there some easy way to organize them automatically?

Better to have a tool because there're quite a lot files to clean up.

like image 567
Ken Yao Avatar asked Feb 13 '09 17:02

Ken Yao


People also ask

What are the two main ways a file can be Organised in C?

Writing to a file (fprintf or fputs)

How do you organize C++ files?

Stack them up in Source and module folder like default it does. Make Public and Private folder inside it, Public should have header files that will be exposed outside of module, private should have all cpp files and header files to classes not exposed to outside of the module.


1 Answers

Why bother organizing in alpha order? The IDE provides a drop down list in order for you to use if you wish to access them in that manner.

Instead the source file should contain them in a meaningful order (what is meaningful is rather subjective) either by the specifics of their tasks or by some sensible convention if nothing else exists (such as by visibility, or placing properties together).

Auto layout rules are a nightmare for source repositories since they put in needless mass movements that frustrate your ability to identify real change, as such they should be avoided unless the rules comply with one of the following:

  • They never change and you can apply it from the beginning of your project
  • They change very rarely and changing will affect at most a single line movement (like bracketing structure)
  • They change rarely and the effect is simply on white space within a line

If the answer is at all beyond 'rarely' you don't want to use it full stop, efficient browsing of historical changes is more useful.

like image 120
ShuggyCoUk Avatar answered Sep 19 '22 15:09

ShuggyCoUk