Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MyClass c = 10;
有什么办法可以让这段代码工作吗?我知道通过隐式运算符重载你可以得到相反的工作:
int i = instanceOfMyClass;
谢谢
当然...
class MyClass { public static implicit operator MyClass(int value) { /* your code */ } }