C# Integer Variable Types
Part of the C# 2010 All-In-One For Dummies Cheat Sheet
C# integer variables come in a variety of types and ranges. The following table sorts out the C# integer variables so you’ll always know the range and size of each.
| Type | Size (bytes) | Range | In Use |
|---|---|---|---|
| sbyte | 1 | –128 to 127 | sbyte sb = -12; |
| byte | 1 | 0 to 255 | byte b = 12; |
| short | 2 | –32,768 to 32,767 | short sn = -123; |
| ushort | 2 | 0 to 65,535 | ushort usn = 123; |
| int | 4 | –2,147,483,648 to 2,147,483,647 | int n = 123; |
| uint | 4 | 0 to 4,294,967,295 | uint un = 123U; |
| long | 8 | –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 — “a whole lot” | long l = 123L; |
| ulong | 8 | 0 to 18,446,744,073,709,551,615 | long ul = 123UL; |











