November 2002
Intermediate to advanced
560 pages
11h 16m
English
The type system of the Common Language Runtime is divided into two worlds. Reference types are heap-allocated types and are used for most objects. Value types are either stack-allocated or allocated as part of another object; they are used for the predefined numeric types and other types that “feel like data.”
This two-type system presents a problem for languages such as C#, which wish to present a unified type system where possible. If reference types and value types remained in separate worlds, it wouldn't be possible to write something like the following:
int value = 55;
double precision = 0.35;
Console.WriteLine("Result: {0}, {1}", value, precision);
For this code to work would require an ...
Read now
Unlock full access