7.5 The C# Reference Types
Reference types store references to actual data. In C#, reference types fall into the following categories:
The class and interface keywords should be intuitive. They are used to define classes and interfaces, respectively. The delegate keyword is used to define references to a function (see Chapter 18). When you instantiate a delegate with parameters passed to it, that calls the underlying function to which the delegate is pointing. The two commonly used classes in the .NET Framework are System.Object and System.String. Their aliases are object and string, respectively. All data types inherit from System.Object. This inheritance enables value types (known as primitives in Java) to be treated as objects in C#. Value types梚ncluding both struct types and built-in types such as int梒an be converted to and from the type object. As mentioned in Chapter 3, this conversion is transparent to the programmer and is called boxing and unboxing. The following section discusses this process in detail.
 |