相关疑难解决方法(0)

是否有在C#中重载赋值运算符的解决方法?

与C++不同,在C#中,您不能重载赋值运算符.

我正在为具有非常大数字的算术运算做一个自定义Number类,我希望它具有内置数值类型的外观,如int,decimal等.我已经重载了算术运算符,但是任务仍然是......

这是一个例子:

Number a = new Number(55); 
Number b = a; //I want to copy the value, not the reference
Run Code Online (Sandbox Code Playgroud)

该问题是否有解决方法?

c# operator-overloading

32
推荐指数
3
解决办法
2万
查看次数

标签 统计

c# ×1

operator-overloading ×1