原文:C#——找出实现某个接口的所有类 - Hello World - CSDN博客
网址:yii666.com文章来源地址:https://www.yii666.com/article/756207.html版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012526003/article/details/51171739文章地址https://www.yii666.com/article/756207.html
C#找出所有实现某一接口的类
//这里找出了实现IOutputArray接口的所有类
private void FindAllClass()
{
var types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(a => a.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IOutputArray))))
.ToArray();
foreach (var v in types)
{
Console.WriteLine(v.FullName);
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11