Data Type |
System Type |
Visual Basic .NET Alias |
C# Alias |
Range |
Precision |
Use |
Boolean |
System.Boolean |
Boolean |
bool |
True/False |
Exact |
For values that can only be true or false. |
Integer |
System.Byte(unsigned) |
Byte |
byte |
0 to 255 |
Exact |
When storage size matters, such as a large array of small numbers. |
System.Int16(signed) |
Short |
short |
-32,768 to 32,767 |
Exact |
System.Int32(signed) |
Integer |
int |
2,147,483,648 to 2,147,483,647 |
Exact |
Standard integer for general use. |
System.Int64(signed) |
Long |
long |
9,223,372,036, 854,775,808 to 9,223,372,036, 854,775,807 |
Exact |
Only when you require an extremely large integer number (inefficient). |
Fractional |
System.Single |
Single |
float |
±1.5 × 10-45 to ±3.4 × 1038 |
About seven digits of precision |
For fractional numbers when little precision is needed for fractional numbers. |
System.Double |
Double |
double |
±5.0 × 10-324 to ±1.7 × 10308 |
About 15 digits of precision |
Standard floating-point number for fractional values. |
System.Decimal |
Decimal |
decimal |
1.0 × 10-28 to 7.9 × 1028 |
About 28 digits of precision |
For fractional numbers only when high precision is needed (inefficient). |
Date |
System.DateTime |
Date |
Use system type |
1/1/0001 to 12/31/9999 |
100-nanosecond precision |
Standard for date and time values. Use Timespan for time intervals. |
Char |
System.Char |
Char |
char |
|
Unicode |
For single characters and character arrays. |
String |
System.String |
String |
string |
|
Unicode |
Standard for string. Use StringBuilder for changes because string is immutable. |