Datasheet

We won’t list all of the built-in value types here, because they are covered in detail in Chapter 3, “Objects
and Types.” In C#, each predefined type recognized by the compiler maps onto one of the IL built-in
types. The same is true in Visual Basic 2005.
Common Language Specification
The Common Language Specification (CLS) works with the CTS to ensure language interoperability. The
CLS is a set of minimum standards that all compilers targeting .NET must support. Because IL is a very
rich language, writers of most compilers will prefer to restrict the capabilities of a given compiler to only
support a subset of the facilities offered by IL and the CTS. That is fine, as long as the compiler supports
everything that is defined in the CLS.
For example, take case sensitivity. IL is case sensitive. Developers who work with case-sensitive languages
regularly take advantage of the flexibility that this case sensitivity gives them when selecting variable
names. Visual Basic 2005, however, is not case sensitive. The CLS works around this by indicating that
CLS-compliant code should not expose any two names that differ only in their case. Therefore, Visual
Basic 2005 code can work with CLS-compliant code.
This example shows that the CLS works in two ways. First, it means that individual compilers do not have
to be powerful enough to support the full features of .NET — this should encourage the development of
compilers for other programming languages that target .NET. Second, it provides a guarantee that, if
It is perfectly acceptable to write non-CLS-compliant code. However, if you
do, the compiled IL code isn’t guaranteed to be fully language interoperable.
Type Meaning
Interface Types
Interfaces.
Pointer Types
Pointers.
Self-describing Types
Data types that provide information about themselves for the bene-
fit of the garbage collector (see the next section).
Arrays
Any type that contains an array of objects.
Class Types
Types that are self-describing but are not arrays.
Delegates
Types that are designed to hold references to methods.
User-defined Reference
Types
Types that have been defined in source code and are stored as refer-
ence types. In C# terms, this means any class.
Boxed Value Types
A value type that is temporarily wrapped in a reference so that it
can be stored on the heap.
12
Part I: The C# Language
24727c01.qxd:WroxPro 5/7/07 12:12 PM Page 12