Built-in Types

C# includes several built-in types that fall into the categories of both reference types and value types. Table 2.1 displays the built-in C# types, allowed values, and examples (with literal suffixes where appropriate). Suffixes can be expressed in either upper- or lowercase.

Table 2.1. C# Built-in Types

TYPE NAME

ALLOWED VALUES

EXAMPLE AND/OR LITERAL SUFFIX

bool

true or false

true

char

A single Unicode character

'A'

sbyte

-128 to 127 (8-bit)

-16

byte

0 to 255 (8-bit)

32

short

-32768 to 32767 (16-bit)

-256

ushort

0 to 65535 (16-bit)

128

int

-2147483648 to 2147483647 (32-bit)

-100000

uint

0 to 4294967295 (32-bit)

200000

long

-9223372036854775808 to 9223372036854775807 (64-bit)

-5000000000L

ulong

0 to 18446744073709551615 (64-bit)

10000000000L

float

1.5 x 10-45 to 3.4 x 1038 (32-bit/7-digit precision)

375.95f

double

5.0 x 10-324 to 1.7 x 10308 (64-bit/15 16-digit precision)

1.0000000001d

decimal

1.0 x 10-28 to 7.9 x 1028 (128-bit/15 16 decimal places)

75.95m

string

A sequence of Unicode characters

"Welcome"

object

The ultimate base type for all other types

object obj = new MyType();



C# Builder KickStart
C# Builder KickStart
ISBN: 672325896
EAN: N/A
Year: 2003
Pages: 165

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net