2. API Design

You communicate with your users when you design the APIs you create for your types. The constructors, properties, and methods you expose publicly should make it easier for developers who want to use your types to do so correctly. Robust API design takes into account many aspects of the types you create. It includes how developers can create instances of a type. It includes how you choose to expose the type’s capabilities through methods and properties. It includes how an object reports changes through events or outbound method calls. Finally, it includes how you express commonality among different types.

Item 11: Avoid Conversion Operators in Your APIs

Conversion operators introduce a kind of substitutability between classes. Substitutability ...

Get More Effective C# (Includes Content Update Program): 50 Specific Ways to Improve Your C#, 2nd edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.