0
It's a textbook example. You can explain work of it.
Ńlass C { int i; public C (int i) { this. i = i;} public static explicit operator C (string s> { return new C (int. Parse(s)) ; } } object o = "1'; dynamic d =" 2"; var c1 = (C) o; //error var c2 = (C) d;
1 Answer
+ 1
Explicit operator used to convert something to class where you declare it.
In this case operator c will convert string to int.
But here object o = "1'; there are single quot instead of dual used, this is probably why var c1 = (C) o; statement marked with error.