摘要:
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&quo 阅读全文
posted @ 2011-04-08 20:39 billpeng 阅读(11038) 评论(2) 推荐(4) 编辑