Chapter 12. Interfaces, Structs, and Enums

The previous chapters have been focused on classes, but C# supports other categories of types, three of which are the subject of this chapter: interfaces, structs, and enums.

Must C# programmers won't use these types as frequently as classes, but each of these three has its place in the programming tool set, and a working knowledge of them is useful, not least because you will find examples of each when you come to use the .NET Framework. Table 12-1 provides the summary for this chapter.

Table 12-1. Quick Problem/Solution Reference for Chapter 12

Problem

Solution

Listings

Impose consistent features on types that are otherwise unrelated.

Define and implement an interface.

12-1 through 6, 12-10, 12-11, 12-14, ...

Get Introducing Visual C# 2010 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.