A: 

I use File: Option-3 and a mix of "Within class: Option-1" + "Within class: Option-2" depends on the class type. If there is clear relationship then I'll go for option-2 but most of the time I stick with Option-1.

dr. evil
+3  A: 

I only have a single element per file. If you need to group things together to tidy them up, then that is what namespaces are for.

I also tend to stick fields and properties at the top of classes, followed by the constructors, then methods. I usually keep private methods next to the public ones that use them.

Edit: And under no circumstances should you use regions! ever. at all. If youre class is so big you need to collapse huge portions of it youve got far worse problems to worry about.

Andrew Bullock
Agree with everything apart from comment on regions. There are appropriate circumstances for regions.
Martin Clarke
OH THANK CHRIST I AM NOT ALONE!!! Dude +1 (+thousands if I could) for rejecting regions. Thank you!
Binary Worrier
What circumstances?
Andrew Bullock
(apologies if I've started a region flame)
Binary Worrier
We have a large static class for quickly getting a SqlCommand object for various stored procedures. Though the individual methods are auto-generated the file itself is not (don't ask) We use regions to region off related stored procedures so that it's easier to find them if for some reason the...
Sekhat
Sometimes I'll put multiple classes in the same file, provided they are very small (e.g. one page or less) and very closely related. And very much agree re: regions. An abomination against readability.
Wedge
generated method needs changing
Sekhat
A: 

I usually use Option-3 for files and Option-1 within classes. Classes are structured by this regions:

  • Nested Classes
  • Constants
  • Events / Delegates
  • Fields
  • Construction / Destruction / Finalization
  • Properties
  • Methods
m0rb
+2  A: 

I generally put types in their seperate files. (Enums, structs, classes and delegates) Nested types go in the same file as their parenting type. Partial files are only used with generated files.

Within a file, the main structure is:

  • Nested classes
  • Consts, fields, event and delegate fields
  • Properties
  • Ctors
  • Finalizer
  • Methods (related ones are close to eachother, not necessarily grouped by accessibillity.)

I'm not too strict on these rules. They're guidelines...

Arjan Einbu
+1 for "guidelines", creating multiple files, one each for a two element enum (to help avoid bool parameters) starts making things harder to follow.
Richard
A: 

I also would put only one element per file. It's easier to find the elements if they are in their own file, especially in large projects.

A: 

Robert C Martin's book Clean Code provides some useful guidance on this- although the contents are for Java, I found the guidance still very applicable to .NET.

The most important thing is to pick a style and stick with. StyleCop is very useful for enforcing these rules.