The following is a list of implicit conversions between
.Net DataTypes |
Source |
Target Data Types |
byte |
short, ushort, int, uint, long, ulong, float,
double, or decimal |
sbyte |
short, int, long, float, double, or decimal |
Int |
long, float, double, or decimal |
uint |
long, ulong, float, double, or decimal |
short |
int, long, float, double, or decimal |
ushort |
int, uint, long, ulong, float, double, or
decimal |
long |
float, double, or decimal |
ulong |
float, double, or decimal |
float |
double |
char |
ushort, int, uint, long, ulong, float, double,
or decimal |
You cast expressions that you want to explicitly
convert using the same syntax as Java:
|
The following table lists explicit
conversions.
.Net Data-Types |
Source Data Type |
Target Data Types |
byte |
sbyte or char |
sbyte |
byte, ushort, uint, ulong, or char |
Int |
sbyte, byte, short, ushort, uint, ulong, or char |
uint |
sbyte, byte, short, ushort, int, or char |
short |
sbyte, byte, ushort, uint, ulong, or char |
ushort |
sbyte, byte, short, or char |
long |
sbyte, byte, short, ushort, int, uint, ulong, or
char |
ulong |
sbyte, byte, short, ushort, int, uint, long, or
char |
float |
sbyte, byte, short, ushort, int, uint, long, ulong,
char, or decimal |
double |
sbyte, byte, short, ushort, int, uint, long, ulong,
char, float, or decimal |
char |
sbyte, byte, or short |
decimal |
sbyte, byte, short, ushort, int, uint, long, ulong,
char, float, or double |
|