Appendix C. Common Datatypes

Each of the .NET languages might 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 the class Int32, and the boolean is mapped to the class Boolean in the System namespace. Table C-1 lists all simple datatypes common to the .NET Framework. Non-CLS-compliant types are not guaranteed to interoperate with all CLS-compliant languages.

Table C-1. Common datatypes

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

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

Get .Net Framework Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.