Tuesday, 28 June 2011

Sort C# Code Structure In Visual Studio 2010 With CodeSorter

One of the most tiring task you might have to perform over source code files everyday is code sorting. Since there aren’t any set conditions which one can instantly apply over source code file to make it look tidy and clean, users have to manually sort the code structure according to their requirements. If you’re looking for a relatively easy way to sort your C# code in Visual Studio 2010, you can try out CodeSorter to specify code sorting conditions, so that they can be applied with a single click over all the code files. The add-in only works with C# project files and may disturb code structure of other languages. The add-in has a host of different code sorting conditions which can be customized in numerous ways. It was developed to sort source code files by different conditions such as, names, types; including, class, struct, method, virtual modifiers; virtual overide, new, etc.


It adds two code sorting options in Tools menu – Sort Code and Sort All Files in Project. The Sort Code option sorts code structure of only currently open file whereas the latter option sorts all the files present in your project. Before sorting out code, you need to configure the code sorting conditions. Open Code Sorter Options from Tools menu.
code sort 2
In ConfigWindow, you have different code sorting types. In Sort Order tab,  you can change the order of items in the way you want your code to be sorted from View pane. If you want to remove one element from here, just select it and click Remove button to send it to Available items.
code sorter 2
Under Constness Order tab, you have all the const related items available in right pane, which includes, Static, Const, Readonly, StatReadonly, Extern, etc,
sort code 3
Similarly, you can rearrange items in Type, Virtuality, and Visibility Order tabs. Once all items are in order, close the ConfigWindow.
type order 2
Now open the C# file to sort the code, and hit Sort Code to sort code structure according to set conditions. CodeSorter only works on Visual Studio 2010.
Download CodeSorter

No comments:

Post a Comment