通过本文主要向大家介绍了马桶c的个人空间,c语言,欲情 c max,维生素c,crh2c等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
B为一个类,ISay为一个接口。
方法1:
B b = new B();
if (b.GetType().GetInterface("ISay") != null)
{
//如果实现了接口“ISay”,...
}
</div>
方法2:
B b = new B();
if (b is ISay)
{
Console.WriteLine("类B实现了接口ISay");
}
</div>
方法3:
B b = new B();
ISay say = b as ISay;
if (say != null)
{
Console.WriteLine("类B实现了接口ISay");
}
</div>