在C#中从16位无符号整数(ushort)隐式转换为Decimal
UShort表示一个16位无符号整数。
要将16位无符号整数隐式转换为十进制,请首先设置ushort值。
ushort val = 193;
要将ushort转换为十进制,请分配值。
decimal dec; dec = val;
让我们来看一个例子。
示例
using System;
public class Demo {
public static void Main() {
ushort val = 2567;
decimal dec;
Console.WriteLine("Implicit conversion from 16-bit unsigned integer to Decimal");
dec = val;
Console.WriteLine("Decimal = "+dec);
}
}热门推荐
10 祝孙辈生日祝福语简短
11 恋人跨年祝福语大全简短
12 考大学敬酒简短祝福语
13 开工投产大吉祝福语 简短
14 偶然结婚祝福语朋友简短
15 感谢学长学姐祝福语简短
16 戏精的祝福语简短
17 我要结婚祝福语简短
18 婚前女儿生日祝福语简短