-4

I look for free extension for Visual Studio 2012, which will guard me to write class in correct oreder:

1st const
2nd private fields
3rd constructors etc...

Sergey Berezovskiy
  • 232,247
  • 41
  • 429
  • 459
Jacek
  • 11,661
  • 23
  • 69
  • 123
  • 2
    Personally, I would be concerned that you think such a tool is adding actual value - that seems a ridiculous thing to be obsessed about, especially if it makes the context / usage of fields less clear. The only time when "order" matters is in inter-related field-initializers, and then IMO the only "correct" thing to do is to move the code to .ctor or .cctor – Marc Gravell Jul 29 '13 at 12:08

2 Answers2

6

You can do this with StyleCop, but I would not call this the "correct" order. This is an artificial ordering of the elements of a class that is easily enforced by a machine, but is not a good scheme for readability and maintenance.

Community
  • 1
  • 1
jason
  • 236,483
  • 35
  • 423
  • 525
1

Regionerate can handle your requirement. However, I'm not sure it still maintained.

However, my personal preference goes to Codemaid. Its "spade" tool allow to manually but quickly reorder class' members. This allow to remove mess in a class, but with no military requirement to sort alphabetically.

Steve B
  • 36,818
  • 21
  • 101
  • 174