我有一个类似下面的课程.GetInterfaces()说
如果当前Type表示泛型类型或泛型方法的定义中的类型参数,则此方法搜索接口约束以及从类或接口约束继承的任何接口.
我有可能没有得到任何继承的接口吗?当我在ABC上使用GetInterfaces时我只想看DEF,而不是DEF和GHI.
interface DEF : GHI {...}
class ABC : DEF {...}
Run Code Online (Sandbox Code Playgroud) 有人能告诉我如何使用C#反射找到类实现的所有接口吗?
就像找到实现特定接口的所有类一样
if(type.getInterface(typeof(IAuto)) != null)
{
console.writeline(type.name.tostring());
}
Run Code Online (Sandbox Code Playgroud)