可以使用C#反射来查找一个类实现的所有接口,就像查找实现特定接口的所有类一样。
if(type.getInterface(typeof(IAuto)) != null)
{
console.writeline(type.name.tostring());
}
if(type.getInterface(typeof(IAuto)) != null)
{
console.writeline(type.name.tostring());
}
var interfaces = typeof(Classname).GetInterfaces();