Our Newsletter


Subscribe to our Newsletter and we'll keep you notified of new products, giveaways and discounts.

We respect your email privacy and will never sell or share your details with anyone.


Knowledgebase Home | Glossary | Favorites | Contact | Login Knowledgebase Home | Glossary | Favorites | Contact | Login
Search the Knowledgebase Browse by Category
C# Data Types
Article Details

Last Updated
4th of June, 2009

User Opinions (5 votes)
100% thumbs up 0% thumbs down

How would you rate this answer?
Helpful
Not helpful
Boolean Types
Declared using the keyword, bool, Boolean Types are simply true or false.


Arrays
Covered in a separate KB Article.


Integral Types

Type Size (in bits) Range
sbyte 8 -128 to 127
byte 8 0 to 255
short 16 -32768 to 32767
ushort 16 0 to 65535
int 32 -2147483648 to 2147483647
uint 32 0 to 4294967295
long 64 -9223372036854775808 to 9223372036854775807
ulong 64 0 to 18446744073709551615
char 16 0 to 65535


Floating Point and Decimal Types

float 32 7 digits 1.5 x 10-45 to 3.4 x 1038
double 64 15-16 digits 5.0 x 10-324 to 1.7 x 10308
decimal 128 28-29 decimal places 1.0 x 10-28 to 7.9 x 1028


Strings
Strings are text characters. The following table shows special syntax required for non-printable characters.

Escape Sequence Meaning
\' Single Quote
\" Double Quote
\\ Backslash
\0 Null, not the same as the C# null value
\a Bell
\b Backspace
\f form Feed
\n Newline
\r Carriage Return
\t Horizontal Tab
\v Vertical Tab


Operators
(The Direction column indicates the direction in which the operators are evaluated. Left means left-to-right and vice versa)

Category (by precedence) Operator(s) Direction
Primary x.y  f(x)  a[x]  x++  x--  new  typeof  default  checked  unchecked delegate left
Unary +  -  !  ~  ++x  --x  (T)x left
Multiplicative *  /  % left
Additive +  - left
Shift <<  >> left
Relational <  >  <=  >=  is as left
Equality ==  != right
Logical AND & left
Logical XOR ^ left
Logical OR | left
Conditional AND && left
Conditional OR || left
Null Coalescing ?? left
Ternary ?: right
Assignment =  *=  /=  %=  +=  -=  <<=  >>=  &=  ^=  |=  => right




Visitor Comments
No visitor comments posted. Post a comment
Post Comment for "C# Data Types"
To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.
   Your Name:
   Email Address:
* Your Comment:
* Enter the code below:
 
Related Articles
No related articles were found.
Attachments
No attachments were found.