Free mag vol1 | Page 13

 CONTENTS The System.Array Base Class............................................................................................................... 138 Understanding the enum Type.......................................................................................140 Controlling the Underlying Storage for an enum .................................................................................. 141 Declaring enum Variables..................................................................................................................... 142 The System.Enum Type ........................................................................................................................ 143 Dynamically Discovering an enum’s Name/Value Pairs ....................................................................... 143 Understanding the Structure Type.................................................................................146 Creating Structure Variables ................................................................................................................ 147 Understanding Value Types and Reference Types.........................................................149 Value Types, References Types, and the Assignment Operator ........................................................... 150 Value Types Containing Reference Types............................................................................................. 151 Passing Reference Types by Value....................................................................................................... 153 Passing Reference Types by Reference ............................................................................................... 155 Final Details Regarding Value Types and Reference Types.................................................................. 156 Understanding C# Nullable Types..................................................................................157 Working with Nullable Types ................................................................................................................ 158 The ?? Operator.................................................................................................................................... 159 Summary .......................................................................................................................160  Part III: Object-Oriented Programming with C#..................................................161  Chapter 5: Understanding Encapsulation ...........................................................163 Introducing the C# Class Type .......................................................................................163 Allocating Objects with the new Keyword ............................................................................................ 166 Understanding Constructors ..........................................................................................166 The Role of the Default Constructor ..................................................................................................... 167 Defining Custom Constructors.............................................................................................................. 167 The Default Constructor Revisited ........................................................................................................ 169 The Role of the this Keyword.........................................................................................170 xi