For example implicitly
MyClass myClass = new MyClass(); int i = myClass;
class MyClass { public static implicit operator int(MyClass myClass) { // code to convert from MyClass to int } }
Take a look there : implicit