For example implicitly
MyClass myClass = new MyClass();
int i = myClass;
You need to define this in the MyClass
file.
public static implicit operator int(MyClass instance)
{
if (instance == null)
{
return -1;
}
return instance._underlyingValue;
}
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