mardi 7 juin 2016

Get base interface of an interface by reflection in C#

How can I get base interface of an interface by reflection? I have tried to call BaseType propery, but value of It is null. After that I need to find generic type class of interface.

I need to find Foo type from the type of ISomeInterfaceForItem on this sample.

Type oType = typeof(ISomeInterfaceForItem);

Type oBase = oType.BaseType; // equals null

public interface ISomeInterfaceForItem: ISomeInterface<Foo>
{        
}

public interface ISomeInterface<T>
{
}





Aucun commentaire:

Enregistrer un commentaire