Chapter 2. Creating Versatile Types

Whenever you create your own classes, you need to consider the circumstances under which they could be used. For example, will two instances of your Item struct ever be compared for equality? Will your Person class need to be serializable, or sortable?

Note

Versatility means being able to do many things well. When you’re creating your own types, it means outfitting your objects with enough “extra” stuff ...

Get C# 4.0 How-To 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.