Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. .Net API GetMembers(BindingFlags) returns some additional members.

.Net API GetMembers(BindingFlags) returns some additional members.

Scheduled Pinned Locked Moved .NET (Core and Framework)
questioncsharpdatabasevisual-studiodata-structures
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Manish Paul
    wrote on last edited by
    #1

    Hi, In VS 2005 I am using Reflection to parse .Net System libraries. Using GetMembers(BindingFlags) returns some additional methods other what is defined in the interface/class in .Net system library. For filtering out I am using following BindingFlags combination

    BindingFlags::Public | BindingFlags::Instance | BindingFlags::Static | BindingFlags::DeclaredOnly

    I am trying to get the declared members in class/interface say for example System.Collection.ICollection which has following 4 members:

    int Count { get; }
    bool IsSynchronized { get; }
    object SyncRoot { get; }
    void CopyTo(Array array, int index);

    However using GetMembers I get following 7 members:

    int Count { get; }
    bool IsSynchronized { get; }
    object SyncRoot { get; }
    void CopyTo(Array array, int index);

    int get_Count();
    bool get_IsSynchronized();
    object get_SyncRoot()

    I get extra 3 get methods corresponding to each property. How do I suppress or filter out these additional members? ~Manish

    M 1 Reply Last reply
    0
    • M Manish Paul

      Hi, In VS 2005 I am using Reflection to parse .Net System libraries. Using GetMembers(BindingFlags) returns some additional methods other what is defined in the interface/class in .Net system library. For filtering out I am using following BindingFlags combination

      BindingFlags::Public | BindingFlags::Instance | BindingFlags::Static | BindingFlags::DeclaredOnly

      I am trying to get the declared members in class/interface say for example System.Collection.ICollection which has following 4 members:

      int Count { get; }
      bool IsSynchronized { get; }
      object SyncRoot { get; }
      void CopyTo(Array array, int index);

      However using GetMembers I get following 7 members:

      int Count { get; }
      bool IsSynchronized { get; }
      object SyncRoot { get; }
      void CopyTo(Array array, int index);

      int get_Count();
      bool get_IsSynchronized();
      object get_SyncRoot()

      I get extra 3 get methods corresponding to each property. How do I suppress or filter out these additional members? ~Manish

      M Offline
      M Offline
      Mark Churchill
      wrote on last edited by
      #2

      A property is just a declaration which specifies the get and set methods. Either use GetMethods or take a look at the MemberInfo, theres a whole bunch of info exposed there that you can use for filtering.

      Mark Churchill Director, Dunn & Churchill Pty Ltd Free Download: Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.
      Alpha release: Entanglar: Transparant multiplayer framework for .Net games.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups