http://www.cnblogs.com/yeagen/archive/2011/04/08/2009889.html
B为一个类,ISay为一个接口。
方法1:
B b = new B(); if (b.GetType().GetInterface("ISay") != null) { //如果实现了接口“ISay”,... }
方法2:
B b = new B(); if (b is ISay) { Console.WriteLine("类B实现了接口ISay"); }
方法3:
B b = new B(); ISay say = b as ISay; if (say != null) { Console.WriteLine("类B实现了接口ISay"); }