Get only direct interface instead of all?

前端 未结 6 2271
借酒劲吻你
借酒劲吻你 2020-12-17 09:43

I have a class like the below. GetInterfaces() says

If the current Type represents a type parameter in the definition of a generic type or generic

6条回答
  •  Happy的楠姐
    2020-12-17 10:25

    As far as I can tell, none of the posted solutions work for typeof(C1) and typeof(I3) in the example below.

    I think the correct answer is that it is not possible to get the directly implemented interfaces using out-of-the-box framework calls.

    private interface I1 { }
    
    private interface I2 : I1 { }
    
    private interface I3 : I2, I1 { }
    
    public class C1 : I3, I1 { }
    

提交回复
热议问题