Some more on the implicit operator

Published 22 Mai 08 09:59 | realfiction - TrivadisContent

Elaborating on my past post on the implicit operator in C#, here some additional information to round this thing up.

  • Can you inherit the implicit operator(s)?

No, you cannot. Within a type you could write as many implicit operator implementations as you like,
but any of the two types referenced must be the enclosing type. The compiler will tell you that:

error CS0556: User-defined conversion must convert to or from the enclosing type

As an example:

read more

Lesen Sie den vollständigen Eintrag unter http://realfiction.net/?q=node/159

Abgelegt unter: , ,