I have a class hierarchy where I use the new
keyword several times due to a good reason. When I try to call GetPropertyValue
on a member which is hiding another, then I get an AmbigousMatchException
even if I specify ExludeHiddenMembers
in the bindingflags. Is this by design? If yes why?
I checked the source code and I can see that it checks for some bindingflags and retrieves all properties if they present, but it doesn't include flags there like ExcludeHiddenMembers
, etc. But they would require processing the whole type tree too, so is it a bug then?...
Here is the relevant part:
public static PropertyInfo Property(this Type type, string name, Flags bindingFlags)
{
// I think here should be the above mentioned flag too
if (bindingFlags.IsAnySet(Flags.PartialNameMatch | Flags.TrimExplicitlyImplemented))
return Enumerable.FirstOrDefault<PropertyInfo>((IEnumerable<PropertyInfo>) PropertyExtensions.Properties(type, bindingFlags, name));
...
}
Unfortunately as I can see the project seems to be quite dead currently.
Aucun commentaire:
Enregistrer un commentaire