Each of the .NET languages can provide its own keywords for the types it supports. For example, a keyword for an integer in VB is Integer, whereas in C# or C++ it is int; a boolean is Boolean in VB, but bool in C# or C++. In any case, the integer is mapped to the class Int32, and the boolean is mapped to the class Boolean in the System namespace. Table C-1 lists all simple data types common to the .NET Framework. Non-CLS-compliant types are not guaranteed to interoperate with all CLS-compliant languages.
Type |
Description |
---|---|
Boolean |
True or false. |
Byte |
8-bit unsigned integer: 0 to 255. |
Char |
Character. Unicode 16-bit character. |
DateTime |
Represents a date and time value. |
Decimal |
Can represent positive and negative values with 28 significant digits: -79,228,162,514,264,337,593,543,950,335 to 79,228,162,514,264,337,593,543,950,335 . |
Double |
Stores 64-bit floating-point values: -1.79769313486231570e308 to 1.79769313486231570e308. |
Guid |
Represents a globally unique identifier (GUID); this is stored internally as a 128-bit integer. Commonly represented as a series of lowercase hexadecimal digits in groups of 8, 4, 4, 4, and 12 digits and separated by hyphens (e.g., 382c74c3-721d-4f34-80e5-57657b6cbc27). |
Int16 |
Stores 16-bit signed integers: -32,768 to 32,767. |
Int32 |
Stores 32-bit signed integers: -2,147,483,648 to 2,147,483,647. |
Int64 |
Stores 64-bit signed integers: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. |
SByte |
Represents an 8-bit signed integer. The SByte type is not CLS-compliant. -128 to 127. |
Single |
Represents an IEEE 754f, single precision, 32-bit value: -3.40282346638528859e38 to 3.40282346638528859e38. |
String |
Represents a string of Unicode characters. |
UInt16 |
Represents a 16-bit unsigned integer. The UInt16 type is not CLS- compliant. 0 to 65,535. |
UInt32 |
Represents a 32-bit unsigned integer. The UInt32 type is not CLS- compliant. 0 to 4,294,967,295 |
UInt64 |
Represents a 64-bit unsigned integer. The UInt64 type is not CLS- compliant. The UInt64 data type can represent positive integers with 18 significant digits: 0 to 184,467,440,737,095,551,615. |
Void |
Void. |
Table C-2 shows a number of useful container types that the .NET Framework provides.
Type |
Description |
---|---|
Array |
General array construct. |
ArrayList |
This class implements the IList interface. The array can grow or shrink dynamically in size. |
BitArray |
This class represents a compact array of bit values. Each element represents a Boolean value (true/false). |
HashTable |
This class represents a collection of associated keys and values that are organized based on the hash code of the key. |
Queue |
This class represents a first-in, first-out collection construct. |
SortedList |
This class is similar to HashTable except that all elements are sorted by their actual keys (not hashed) and elements are accessible through either key or index. |
Stack |
This class represents a first-in, last-out stack construct. |