c# - Reflecting over all properties of an interface, including inherited ones? -


I have an example of System.Type that represents an interface, and I have a list of all the properties on it Getting the interface - inherited from those base interfaces. I basically want to do the same behavior with such interfaces which are available for classes. For example, this hierarchy has been given:

  Public interface IBase {public string basePorFT {get; }} Public Interface ISUB: IBIS {public string subproperty {Received; }} Public Class base: ibiz {public string baseforfo {return {return "base"; }}} Public class sub: base, ISUub {public string subproperty {return {return "sub"; }}}  

If I call GetProperties at class - typeof (sub) .GetProperties () - So I get both the BaseProperty and SubProperty I interface I want to do the same thing, but when I try - typeof (ISub) .GetProperties () - Everything comes back to subproperty

I tried passing the binding flag.Instance | Binding Flags. Public | Backing flags.Flaton Hieraki for GetProperties, because of my understanding of FlattenHierarchy that it is supposed to include members from base classes, but the behavior was exactly the same.

I think I can reprocess it Type gate interface () and call GetProperties on each one, but then I will trust GetProperties on one interface Never return the base properties (because if it ever did, I duplicate). I do not want to believe this behavior at least without seeing the documentary.

How do I either:

  • Can you get a list of all the properties on an interface from your base interface?
  • Be at least assured that what I see is a documented behavior on which I can trust, so can I work around it?
  • An answer to the type can be found in comment :

    BindingFlags Passing Type.GetXXX for any one of the types of Whitarini Fleeten, such as Type Gatmember, when you ask yourself on the interface type, return the inherited interface members Will not be returned.

    [...]

    To get the inherited members, you should ask each member for their executed interface.

    The example code is also included. This comment was posted by a Microsoft, so I would say that you can trust it.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -