public static void Main (string[] args) { var t1 = new CustomType1(); var t2 = new CustomType2(); Console.WriteLine("{0}", ((IInterface1)t1).Interface1Method(2)); Console.WriteLine("{0}", ((IInterface1)t2).Interface1Method(3));; }
public static void Main(string[] args) { var t1 = new CustomType1(); var t2 = new CustomType2(); Console.WriteLine("{0} {1}", t1.Interface1Method(1), ((IInterface1)t1).Interface1Method(2)); Console.WriteLine("{0} {1} {2}", t2.Interface1Method(1), ((CustomType1)t2).Interface1Method(2), ((IInterface1)t2).Interface1Method(3));; }
public static void Main (string[] args) { var instanceA = new CustomType(); var instanceB = new CustomType2(); Console.WriteLine( "{0} {1} {2} {3}", instanceA, instanceA.GetType(), instanceB, instanceB.GetType() ); }
public static void Main (string[] args) { var t1 = new CustomType1(); var t2 = new CustomType2(); Console.WriteLine("{0} {1}", t1 is IInterface1, t1 is IInterface2); Console.WriteLine("{0} {1}", t2 is IInterface1, t2 is IInterface2); ((IInterface1)t1).Interface1Method(2); ((IInterface1)t2).Interface1Method(3);((IInterface2)t2).Interface2Method(4); }
public static void Main(string[] args) { var t1 = new CustomType1(); var t2 = new CustomType2(); Console.WriteLine("{0} {1}", t1 is IInterface1, t1 is IInterface2); Console.WriteLine("{0} {1}", t2 is IInterface1, t2 is IInterface2); ((IInterface1)t1).Interface1Method(2); ((IInterface1)t2).Interface1Method(3); ((IInterface2)t2).Interface2Method(4); }
public static void Main(string[] args) { var instanceA = new CustomType(); var instanceB = new CustomType2(); Console.WriteLine( "{0} {1} {2} {3}", instanceA, instanceA.GetType(), instanceB, instanceB.GetType() ); }