static void Main(string[] args) { MyClass ins = new MyClass(); //ins.Method();//error MyI1 ins1 = ins as MyI1; ins1.Method();//interface 1 MyI2 ins2 = ins as MyI2; ins2.Method();//interface 2 Console.ReadKey(); }
static void Main(string[] args) { MyClass ins = new MyClass(); ins.Method(); MyI1 ins1 = ins as MyI1; ins1.Method(); MyI2 ins2 = ins as MyI2; ins2.Method(); Console.ReadKey(); }