What style guide should be followed?
It looks like the original codebase followed Brad Adam's guide that is vastly different to the CoreFx's one, that is indirectly recommended via the docs (developer guide -> coding guidelines -> C# coding style).
Do we use this.variable or _variable?
Do we place usings inside or outside namespaces?
Do we sort class members (I actually very much like that rule)?
We follow the CoreFX guidelines on new contributions, but to my understanding, we have not attempted any code-wide refactor. This is for new changes
The one exception are classes which are serialized. @dreddy-work should be able to clarify more
Do we use
this.variableor_variable?
We use _camelCase for internal and private fields and use readonly where possible. Prefix internal and private instance fields with _ , static fields with s_ and thread static fields with t_. When used on static fields, readonly should come after static (e.g. static readonly not readonly static). Public fields should be used sparingly and should use PascalCasing with no prefix when used.
Do we place usings inside or outside namespaces?
Namespace imports should be specified at the top of the file, outside of namespace declarations, and should be sorted alphabetically, with the exception of System.* namespaces, which are to be placed on top of all others.
Do we sort class members (I actually very much like that rule)?
Do you mean sorting imports? I am not aware of any guidance on the ordering of class members
Thanks, it would be good to have these guidelines added to the Wiki, as they do diverge from the CoreFx's guidelines.
Do you mean sorting imports? I am not aware of any guidance on the ordering of class members
Not quite. My questions was about file organisation. E.g. Brad Adams' guide is quite specific about it:
- Classes member should be alphabetized, and grouped into sections (Fields, Constructors, Properties, Events, Methods, Private interface implementations, Nested types)
Personally I quite like this, as it makes tremendously easier to review and reason about the code, especially outside an IDE.
. . .
A little OT, for imports I like these settings:


IIRC there is a StyleCop analyser that can enforce the order of usings.
@zsd4yr in https://github.com/dotnet/winforms/issues/484#issuecomment-467191583 your underscores were interpreted as requesting italics, making your examples a bit confusing.
@zsd4yr Expanding on what @drewnoakes said, you can escape your literal underscores in Markdown by using \_.
Thanks, it would be good to have these guidelines added to the Wiki, as they do diverge from the CoreFx's guidelines.
That is impossible, as I copied and pasted them from the CoreFx guidelines.
Now it all makes sense, thank you all
for imports I like these settings
For any of these, I am more inclined to discuss them if there is a way to set them in the .editorconfig. Does anyone else have any opinions here?
This can be enforced with StyleCope anaylsers

@sharwell is the man to talk about these
Style cop is an institutionally acceptable option. My personal opinion is that I would rather these things me automagically fixed at edit-time ; there should be a way to keep uniform style and avoid additional work necessary on the part of developers.
We should then convince VS team to set the above as defaults, as the 95% of developers don't change settings 馃槈
The issue appears to be resolved. Thanks guys!