Working with the Type System
What You Will Learn in This Chapter
- Using C# value types
- Understanding data structures
- Using enumerations
- Understanding C# reference types
- Working with reference types properties
- Understanding encapsulation
- Using generics
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
You can find the code downloads for this chapter at www.wrox.com/remtitle.cgi?isbn=1118612094 on the Download Code tab. The code is in the chapter03 download and individually named according to the names throughout the chapter.
This chapter introduces you to the type system in C#, which provides the infrastructure necessary to model objects and handle the different types of data and information within a program. As a result, the exam tests your abilities to create and consume types in the C# language.
To help you gain this understanding, you explore types in a sequenced and logical manner. Value types are the simplest types in C#, and the chapter starts there. Not only are they the basic core types you need to store values and data in your code, but they are also used to maintain properties, which are components of C# classes. Class properties define characteristics of the classes you create.
Next, you look at reference types, which Microsoft defines as types that “store references to the actual data.” Another term for reference types is classes.
The key to working with reference types such as a C# class is the concept of encapsulation. Encapsulation enables a developer to create ...