3.7. Reference types

Reference types got their name because they contain references to the objects allocated on the heap. Such types can contain null references and are always passed by reference. This means that an address of the object, not the object itself, is passed to a procedure or function, meaning that changes will be made to the object, not its copy, as we have seen in the previous example for structures. The main reference type is a class – we will learn about this type in the next section.

Classes

By definition, a “class” is a data structure that may contain data members (constants, variables, and events), function members (methods, properties, indexers, operators, and constructors), and nested types. One important note about classes ...

Get A Programmer's Guide to .NET 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.