преобразование |
|
из типа |
в тип |
| sbyte | byte ushort uint ulong char |
| byte | sbyte char |
| short | sbyte byte ushort uint ulong char |
| ushort | sbyte byte short char |
| int | sbyte byte short ushort uint ulong char |
| uint | sbyte byte short ushort int char |
| long | sbyte byte short ushort int uint ulong char |
| ulong | sbyte byte short ushort int uint long char |
| float | sbyte byte short ushort int uint long ulong char decimal |
| double | sbyte byte short ushort int uint long ulong char float decimal |
| decimal | sbyte byte short ushort int uint long ulong char float double |
| char | sbyte byte short |
Main.cs
usingSystem;classProgram {-
publicstaticintMain() { -
sbytesbyteVal=-128; -
//из типа sbyte в тип byte -
bytebyteVal = (byte)sbyteVal; -
Console.WriteLine(byteVal); -
//из типа sbyte в тип ushort -
ushortushortVal = (ushort)sbyteVal; -
Console.WriteLine(ushortVal); -
//из типа sbyte в тип uint -
uintuintVal = (uint)sbyteVal; -
Console.WriteLine(uintVal); -
//из типа sbyte в тип ulong -
ulongulongVal = (ulong)sbyteVal; -
Console.WriteLine(ulongVal); -
//из типа sbyte в тип char -
charcharVal = (char)sbyteVal; -
Console.WriteLine(); -
Console.ReadKey(); -
return0; -
} }
usingSystem;classProgram {-
publicstaticintMain() { -
sbytesbyteVal=-128; -
//из типа sbyte в тип byte -
bytebyteVal = (byte)sbyteVal; -
Console.WriteLine(byteVal); -
//из типа sbyte в тип ushort -
ushortushortVal = (ushort)sbyteVal; -
Console.WriteLine(ushortVal); -
//из типа sbyte в тип uint -
uintuintVal = (uint)sbyteVal; -
Console.WriteLine(uintVal); -
//из типа sbyte в тип ulong -
ulongulongVal = (ulong)sbyteVal; -
Console.WriteLine(ulongVal); -
//из типа sbyte в тип char -
charcharVal = (char)sbyteVal; -
Console.WriteLine(); -
Console.ReadKey(); -
return0; -
} }
128
65408
4294967168
18446744073709551488
65408
4294967168
18446744073709551488