03.01.2015 Views

C# 5.0 Programmer's Reference

Visual Studio 2013 C# 5.0 Programmer's Reference

Visual Studio 2013 C# 5.0 Programmer's Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Data Types ❘ 55<br />

<strong>C#</strong> also groups bytes in different ways to form data types with a greater logical meaning. For<br />

example, it uses 4 bytes to make an integer, a numeric data type that can hold values between<br />

−2,147,483,648 to 2,147,483,647.<br />

The following table summarizes <strong>C#</strong>’s elementary data types.<br />

Name Type Size Values<br />

Boolean bool 2 bytes True or False.<br />

Byte byte 1 byte 0 to 255.<br />

Signed byte sbyte 1 byte −128 to 127.<br />

Character char 2 bytes 0 to 65,535.<br />

Short integer short 2 bytes −32,768 to 32,767.<br />

Unsigned short<br />

integer<br />

ushort 2 bytes 0 through 65,535.<br />

Integer int 4 bytes −2,147,483,648 to 2,147,483,647.<br />

Unsigned integer uint 4 bytes 0 through 4,294,967,295.<br />

Long integer long 8 bytes −9,223,372,036,854,775,808 to<br />

9,223,372,036,854,775,807.<br />

Unsigned long<br />

integer<br />

ulong 8 bytes 0 through 18,446,744,073,709,551,615.<br />

Decimal decimal 16 bytes 0 to +/−79,228,162,514,264,337,593,543,9<br />

50,335 with no decimal point; 0 to +/−7.9<br />

228162514264337593543950335 with 28<br />

places to the right of the decimal place.<br />

Single-precision<br />

floating point<br />

number<br />

Double-precision<br />

floating point<br />

number<br />

float 4 bytes −3.4028235E+38 to −1.401298E-45<br />

(negative values); 1.401298E-45 to<br />

3.4028235E+38 (positive values).<br />

double 8 bytes −1.79769313486231570E+308 to<br />

−4.94065645841246544E-324 (negative<br />

values); 4.94065645841246544E-324 to<br />

1.79769313486231570E+308 (positive<br />

values).<br />

String string varies Depending on the platform, a string can<br />

hold approximately 0 to 2 billion Unicode<br />

characters.<br />

continues<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!