I’ve been using MZTools Visual Studio add-in for a few years. The original reason I acquired it was because of it’s sorting of code ability:
- Sorting a collection of lines
- Sorting the elements in a class by type and then alphabetical.
I had gotten frustrated by manual re-organizing of code and fighting the random dropping of code where it fell into the file. I love the use of initializers – it keeps code cleaner and easier to read (visually chunking), but with rapid evolution of code, we can often end up with something like:
If you are cross-checking two chunks of code, the random sequence becomes a pain and thus decreases code quality. With two clicks the code is transformed into alphabetical order and the code is a lot easier to review or cross-checking.
So properly reviewed code would be:
I would advocate that this be made a part of your regular code review standards, that is:
- Initializers must be used when appropriate (most of the add-in tools will suggest/prompt you to do so and automatically refactor for you).
- Initializers are in alphabetical order