MyClass c = 10;
Is there any way to make this code work? I know that through the implicit operator overloading you can get the opposite to work:
int i = instanceOfMyClass;
Thanks
Sure...
class MyClass
{
public static implicit operator MyClass(int value) { /* your code */ }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With