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 |
---|---|
True or false. | |
8-bit unsigned integer: 0 to 255. | |
Character. Unicode 16-bit character. | |
Represents a date and time value. | |
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 . | |
Stores 64-bit floating-point values: -1.79769313486231570e308 to 1.79769313486231570e308. | |
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). | |
Stores 16-bit signed integers: -32,768 to 32,767. | |
Stores 32-bit signed integers: -2,147,483,648 to 2,147,483,647. | |
Stores 64-bit signed integers: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. | |
Represents an 8-bit signed integer. The SByte type is not CLS-compliant. -128 to 127. | |
Represents an IEEE 754f, single precision, 32-bit value: -3.40282346638528859e38 to 3.40282346638528859e38. | |
Represents a string of Unicode characters. | |
Represents a 16-bit unsigned integer. The UInt16 type is not CLS- compliant. 0 to 65,535. | |
Represents a 32-bit unsigned integer. The UInt32 type is not CLS- compliant. 0 to 4,294,967,295 | |
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. |
Table C-2 shows a number of useful container types that the .NET Framework provides.