How to know all the interfaces and methods that an object implements?

1

Is there any way to know at run time which Interfaces and which methods to implement an object instance at a given time without explicitly asking for them in the .NET (C #) environment?

    
asked by U. Busto 23.12.2016 в 08:19
source

1 answer

5

Yes, it is possible and easy to obtain that information using Reflection. To get the Interfaces, you can do this:

var interfaces = objeto.GetType().GetInterfaces();

Also for the methods:

var metodos = objeto.GetType().GetMethods();
    
answered by 23.12.2016 / 08:26
source