查找类实现的所有接口

Der*_*van 3 c# reflection

有人能告诉我如何使用C#反射找到类实现的所有接口吗?

就像找到实现特定接口的所有类一样

if(type.getInterface(typeof(IAuto)) != null)
{
   console.writeline(type.name.tostring());
}
Run Code Online (Sandbox Code Playgroud)

Fla*_*ric 9

var interfaces = typeof(Classname).GetInterfaces();
Run Code Online (Sandbox Code Playgroud)