Ordering and Grouping Type Members

Question
You want to know how to best organize type members.

Answer
Group members of the same kind: for example, fields, methods, properties, and so on. Use a #region directive to make collapsing them easier.

Example
Feel free to adopt the following order when defining type members.

1. Event and delegate definitions
2. Private and public fields, except those backed by properties
3. Constructors, including static constructors
4. Instance public properties (and the private fields they back)
5. Instance public methods
6. Static public methods and properties
7. Methods in interfaces
8. Private helper methods

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s