Value Types

Numeric

Signed Integer

TypeRangeSize
sbyte-128 to 127Signed 8-bit integer
short-32,768 to 32,767Signed 16-bit integer
int-2,147,483,648 to 2,147,483,647Signed 32-bit integer
long-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807Signed 64-bit integer

Unsigned Integer

TypeRangeSize
byte0 to 255Unsigned 8-bit integer
ushort0 to 65,535Unsigned 16-bit integer
uint0 to 4,294,967,295Unsigned 32-bit integer
ulong0 to 18,446,744,073,709,551,615Unsigned 64-bit integer

Floating-point Numbers

TypeApproximate RangePrecision
float±1.5e−45 to ±3.4e387 digits
double±5.0e−324 to ±1.7e30815–16 digits
decimal(-7.9 x 1028 to 7.9 x 1028)/(100 to 1028)28–29 significant digits

Logical

TypePossible ValuesSize
booltrue, false8-bit

Character

TypeRangeSize
charU+0000 to U+ffffUnicode 16-bit character

Literals

NameCorresponding datatypeExamples
Integer Literalint40, -39, 291838, 0, …
Float Literalfloat3.5F, -43.5f, 309430.70006F, …
Double Literaldouble28.98, 239.0, -391.089, 0.0, …
Decimal Literaldecimal8.95m, 3283.9M, -30m, …
Boolean Literalbooltrue, false
Character Literalchar'Y', 'a', '0', '\n', '\x0058', '\u0058', …

Compatibility

This table is to be read as

means that those values or variables from the datatypes in the row and column can be “operated together” (meaning, you can for instance multiply them), ✘ means that those values or variables from the datatypes in the row and column cannot be “operated together” (meaning, you cannot for instance multiply them).

 Integer LiteralFloat LiteralDouble LiteralDecimal Literal
int
float
double
decimal

Result Type of Operations

 intfloatdoubledecimal
intintfloatdoubledecimal
floatfloatfloatdoubleillegal
doubledoubledoubledoubleillegal
decimaldecimalillegalillegaldecimal

This table is to be read as

Values or variables from the datatypes in the row and column can be “operated together” and will produce the datatype indicated in the cell, or cannot be “operated together” if the value in the cell is “illegal”.

References