您好,欢迎访问一九零五行业门户网

C# 中的强制转换运算符 () 是什么?

类型转换是将一种类型的数据转换为另一种类型的数据。显式转换由用户使用预定义函数显式完成,并且需要强制转换运算符。
让我们看一个将 double 强制转换为 int 的示例 -
示例using system;namespace demo { class program { static void main(string[] args) { double a = 4563.56; int x; x = (int)a; console.writeline(x); console.readkey(); } }}
为了将 double 转换为 int,我们执行了显式类型转换 -
x = (int)a;
以上就是c# 中的强制转换运算符 () 是什么?的详细内容。
其它类似信息

推荐信息