Sorting methods in class file by access modifiers is good or wrong habit?
Which are another methods for structure of class file?
Sorting methods in class file by access modifiers is good or wrong habit?
Which are another methods for structure of class file?
It depends. You could group them logically, which is the best way IMHO. I believe you could ask one dozen people and get one dozen different answers. It's like the good old 'Should I create #regions for methods/internal methods/properties/fields etc.'-question.
The important thing with coding standards as that they are documented, well known by your team and that they are applied consistently.
It does also help if they aren't too "off-the-wall" compared to the coding standards adopted across the industry.
In this case, the company I am working at currently has a similar policy, which is the place the class in a particular order, with properties, constructors, public methods then private methods.
I have also worked in locations where the private methods are placed close the public methods that consume them - but I have to admit that this tends to get messy as the whole idea of extracting the logic into a separate method was to get re-use.
This is the sorting order that StyleCop uses (if I recall correctly):
Also:
Personally I removed the rule that static members should be placed before non-static members, because this often conflicts with good readability, because I like to be able to read my class like a book, but also like to adhere the rules of FxCop (yet another tool) that points me at instance methods that don't use the this
argument.