小编Die*_*lez的帖子

我如何知道何时在忽略继承的类型中直接实现接口?

出现的问题是当我有一个实现接口的类,并扩展实现接口的类时:

class Some : SomeBase, ISome {}
class SomeBase : ISomeBase {}
interface ISome{}
interface ISomeBase{}
Run Code Online (Sandbox Code Playgroud)

由于typeof(Some).GetInterfaces()返回带有ISome和ISomeBase的数组,我无法区分ISome是实现还是继承(如ISomeBase).作为MSDN我不能假设数组中接口的顺序,因此我迷路了.方法typeof(Some).GetInterfaceMap()也不区分它们.

c# reflection interface

7
推荐指数
1
解决办法
630
查看次数

标签 统计

c# ×1

interface ×1

reflection ×1