Appendix C. Common Data Types

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.

Table C-1. Common data types

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. ...

Get .NET Framework Essentials, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.