[Previous] [Contents] [Next]

Interfaces


Use Pascal casing on all interfaces. It's common to prefix interface names with a capital "I"-for example, IComparable. (This is the only Hungarian notation"like convention that I know of in C#.) -

Many developers use the same rules when naming interfaces as they do when naming classes. However, there's a fundamental philosophical difference between the two. Classes represent an encapsulation of data and the functions that work on that data. Interfaces, on the other hand, represent behavior. By implementing an interface, you're saying that a class can exhibit that behavior. Therefore, a common technique is naming interfaces with adjectives. For example, an interface that declares methods for serializing data might be called ISerializable to easily denote the capability being taken on by the implementing class.

[Previous] [Contents] [Next]