Creating Value Types

The .NET framework recognizes two distinct families of types: value types and reference types.

Value types are relatively simple, small structures that can be created and used directly on the stack. Reference types are essentially objects in their own right, are created on the managed heap, and are subject to Garbage Collected lifetime management.

A value type might be a simple storage type such as an int or a float. It could also be a small structure or class such as time_t or CPoint. A reference type is a class, an interface, an array, and so forth.

Value types created and used on the stack are not subject to GC management because they are effectively deleted by the movement of the stack pointer when they go out of scope. ...

Get C# and the .NET Framework: The C++ Perspective 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.