.NET Type System—Built-in Value Types


Jump to: navigation, search
CSharp-Online.NET:Articles
.NET Articles

.NET Type System

© 2003 Microsoft Corp.

Built-in Value Types

Table 2.1 lists the CLR's built-in value types. In the table, the "CIL Name" column gives the type's name as used in Common Intermediate Language (CIL), which could best be described as the assembly language for the CLR. CIL is described in more detail in Chapter 4, which covers the execution system. The next column, "Base Framework Name," gives the name for the type in the Base Framework. The Base Framework is often referred to as the Framework Class Library (FCL). As the library contains more than just classes, this name is somewhat inaccurate. Chapter 7 covers the Base Framework in more detail.

Table 2.1 CLR Built-in Value Types

CIL Name Base Framework Name Description CLS Support
bool System.Boolean Boolean, true or false Y
char System.Char Unicode character Y
int8 System.SByte Signed 8-bit integer N
int16 System.Int16 Signed 16-bit integer Y
int32 System.Int32 Signed 32-bit integer Y
int64 System.Int64 Signed 64-bit integer Y
unsigned int8 System.Byte Unsigned 8-bit integer Y
unsigned int16 System.UInt16 Unsigned 16-bit integer N
unsigned int32 System.UInt32 Unsigned 32-bit integer N
unsigned int64 System.UInt64 Unsigned 64-bit integer N
float32 System.Single IEEE 32-bit floating-point number Y
float64 System.Double IEEE 64-bit floating-point number Y
native int System.IntPtr equivalent to the machine word size (32 bits on a 32-bit machine, 64 bits on a 64-bit machine) Signed native integer, Y
native unsigned int System.UIntPtr Unsigned native integer N

Note that 8-bit integers appear to be named in an inconsistent manner when compared to the other integral types. Normally, the unsigned integers are known as System.UIntX, where X is the size of the integer. With 8-bit integers, however, the signed version is known as System.SByte, where S means signed. This nomenclature is preferred because unsigned bytes are used more frequently than signed bytes are, so the unsigned byte gets the simpler name.


Previous_Page_.gif Next_Page_.gif




Personal tools

AbeBooks.com – Textbooks