G
Guest
Hi all
I'm looking for a way to obtain all interfaces implemented by a given type, i.e. all interfaces included in the type's class base specification. Sounds easy but the problem is that Type.GetInterfaces returns both inherited and implemented interfaces, including all base interfaces
The following example shows the results of Type.GetInterfaces and the results I'd like to have for various class declarations. Here {A, B} means an array of Type objects typeof(A) and typeof(B)
interface IBase {
interface IDerived: IBase {
class Base: IBase {} // GetInterfaces: {IBase} wanted: {IBase
class Derived1: Base {} // GetInterfaces: {IBase} wanted: {
class Derived2: Base, IBase {} // GetInterfaces: {IBase} wanted: {IBase
class Derived3: Base, IDerived {} // GetInterfaces: {IBase, IDerived} wanted: {IDerived
class Derived4: Base, IBase, IDerived {} // GetInterfaces: {IBase, IDerived} wanted: {IBase, IDerived
Because ildasm is able to display the list of implemented interfaces, it must be stored in metadata. But can it be retrieved using reflection? Any hints are greatly appreciated
Regards
pn
I'm looking for a way to obtain all interfaces implemented by a given type, i.e. all interfaces included in the type's class base specification. Sounds easy but the problem is that Type.GetInterfaces returns both inherited and implemented interfaces, including all base interfaces
The following example shows the results of Type.GetInterfaces and the results I'd like to have for various class declarations. Here {A, B} means an array of Type objects typeof(A) and typeof(B)
interface IBase {
interface IDerived: IBase {
class Base: IBase {} // GetInterfaces: {IBase} wanted: {IBase
class Derived1: Base {} // GetInterfaces: {IBase} wanted: {
class Derived2: Base, IBase {} // GetInterfaces: {IBase} wanted: {IBase
class Derived3: Base, IDerived {} // GetInterfaces: {IBase, IDerived} wanted: {IDerived
class Derived4: Base, IBase, IDerived {} // GetInterfaces: {IBase, IDerived} wanted: {IBase, IDerived
Because ildasm is able to display the list of implemented interfaces, it must be stored in metadata. But can it be retrieved using reflection? Any hints are greatly appreciated
Regards
pn