4. Types

The types of the C# language are classified into two main categories: value types and reference types. Both value types and reference types may be generic types, which take one or more type parameters. Type parameters themselves can designate both value types and reference types.

      type:            value-type            reference-type            type-parameter

A third category of types, pointers, is available only in unsafe code. Pointers are discussed further in §18.2.

Value types differ from reference types in that variables of the value types directly contain their data, whereas variables of the reference types store references to their data, the latter being known as objects. With reference types, it is possible for two variables ...

Get The C# Programming Language, Third Edition 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.