mgravell / fast-member

Automatically exported from code.google.com/p/fast-member
Apache License 2.0
1.02k stars 137 forks source link

Can we have a way to check if a property is indexer type? #101

Open nawfalhasan opened 1 year ago

nawfalhasan commented 1 year ago

Currently there is very limited info exposed by Member class. I cannot determine whether the property is a regular one or an indexer one.

Problem description:
When I try to read all properties of a type dynamically, like this:

        TypeAccessor accessor = TypeAccessor.Create(type);
        var values = accessor.GetMembers().Where(m => m.CanRead).Select(m => accessor[item, m.Name]).ToList();

I get an exception when the member is an indexer. I would like to skip indexers in the above query.

Suggestion:
Can we expose this information as well ? Or worst case, expose the whole MemberInfo which is a private field now.

Otherwise, how do I avoid the exception in the above case?

gurustron commented 1 year ago

Original SO question. And related PR - https://github.com/mgravell/fast-member/pull/102 .