using System; public class MyType { public static implicit operator YourType(MyType s) { Console.WriteLine("conversion here"); return(new YourType()); } } public class YourType { } public class YourDerivedType: YourType { } public class Test { public static void Main() { MyType myType = new MyType(); YourType tb = (YourType) myType; } }
conversion here