【发布时间】:2010-11-10 10:42:41
【问题描述】:
假设我有一个类型,MyType。我想做以下事情:
- 找出 MyType 是否为某些 T 实现 IList 接口。
- 如果 (1) 的答案是肯定的,请找出 T 是什么。
执行此操作的方法似乎是 GetInterface(),但它只允许您按特定名称进行搜索。有没有办法搜索“所有形式为 IList 的接口”(如果接口是 IList 的子接口,如果可能,它也会很有用。)
相关:How to determine if a type implements a specific generic interface type
【问题讨论】:
标签: c# .net reflection