O'Reilly logo

Essential .NET, Volume 1: The Common Language Runtime by Chris Sells, Don Box

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Objects and Values Compared

The type system of the CLR distinguishes between types that correspond to simple values and types that correspond to more traditional “objects.” The former are called value types; the latter are called reference types. Value types support a limited subset of what a reference type supports. In particular, instances of value types do not carry the storage overhead of full-blown objects. This makes value types useful in scenarios where the costs of an object would otherwise be prohibitive. It is important to note that both reference types and value types can have members such as fields and methods, and this means that statements such as the following are legal:

string s = 53.ToString();

Here, 53 is an instance of a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required