7.5. The C# Reference Types

Reference types store references to actual data. In C#, reference types fall into the following categories:

  • class

  • interface

  • delegate

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 ...

Get .NET for Java Developers: Migrating to C# 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.