C# Design Guidelines


Prefer explicit declarations to implicit declarations.  If you’re expecting something from a declaration, explicitly state it.

Never depend on implicit side-effects.

Never design cyclic dependancies, always design ascyclic dependancies.

Prefer readability over complexity.

Never optimize

Always prefer the

Prefer always implementing an empty constructor instead of no public constructor.

There is a side-effect to not implementing any constructors: you get a public general constructor for free.  The drawback to that is if you add a non-general constructor your interface changes.  If something is already constructing your class that will introduce a compile error.

Prefer internal on class declarations rather than no access.

Prefer public on member declarations rather than on access.

Prefer sealed on class declarations unless the class is designed to be derived from.

Leave a Reply

Your email address will not be published. Required fields are marked *