可能的情况有:从一个类继承,从一个或多个接口继承,从一个类和一个或多个接口继承。
使用Type类的BaseType属性来取得类从哪个类继承。GetInterfaces方法来取得类都实现了哪些接口。
测试代码如下:
类库代码:

如何知道一个类都实现了哪些接口和从那个类继承using System;
如何知道一个类都实现了哪些接口和从那个类继承
如何知道一个类都实现了哪些接口和从那个类继承
namespace GetInterface



在winform下显示调用显示:

如何知道一个类都实现了哪些接口和从那个类继承Type type = typeof(GetInterface.Class1);
如何知道一个类都实现了哪些接口和从那个类继承Type[] typeInterface 
= type.GetInterfaces();
如何知道一个类都实现了哪些接口和从那个类继承
foreach ( Type t in typeInterface )
.listBox1.Items.Add ( typeBaseClass.ToString());

相关文章:

  • 2022-12-23
  • 2022-02-08
  • 2022-02-08
  • 2021-11-29
  • 2022-02-08
  • 2021-08-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2021-04-09
  • 2022-12-23
相关资源
相似解决方案