In C# all code belongs to a type. Normally we represent types as classes, but types can also be structures, enumerations, interfaces, etc. Because every code belongs in a type, a number of tasks relating to types are important to understand when writing applications. These tasks include being able to compare variables , being able to determine if an object is compatible with a certain type, and being able to convert from one type to another. Beyond basic comparisons of variables to types and learning mechanisms for casting from one type to another, this chapter will also give you information for redefining cast operators. Cast operators let you define conversion rules for your classes. |