About
In this code snippet, we will take a look at conversion operator overloading in C#.
Conversion operators can be overloaded just like regular operators. This is useful when you want to be able to convert your custom object to another type. We have two types of conversions, implicit and explicit. Implicit conversion can be “just done” no special syntax is required. Meanwhile, explicit conversion requires casting.
Let’s look at the code example below to see how to overload conversion operators.
Code:
[amp-gist id=”296c85bb4d633f503e60336e048f2d9d”]