[rdnzl-devel] .NET error : Ambiguous match found.
Iver Odin Kvello
iverodin at gmail.com
Thu Apr 3 12:12:40 UTC 2008
Browsing through MSDN a bit more, I find this in Type.GetProperty:
===>
Situations in which AmbiguousMatchException occurs include the following:
* A type contains two indexed properties that have the same name
but different numbers of parameters. To resolve the ambiguity, use an
overload of the GetProperty method that specifies parameter types.
* A derived type declares a property that hides an inherited
property with the same name, by using the new modifier (Shadows in
Visual Basic). To resolve the ambiguity, use the GetProperty(String,
BindingFlags) method overload and include
BindingFlags..::.DeclaredOnly to restrict the search to members that
are not inherited.
===>
The last situation is what we have ('new' being used because the
return-value is more specific), and it appears specifying the return
type is then unneccessary. This works:
(INVOKE (INVOKE TLP "GetType") "GetProperty" "Controls"
(OR-ENUMS (FIELD "BindingFlags" "Instance") (FIELD
"BindingFlags" "Public") (FIELD "BindingFlags" "DeclaredOnly")))
perhaps adding this flag in an exception-handler for this case would
be ok, as the first kind of ambiguity should not be possible as all
parameter types are passed. Otherwise, one would need to either add
the return-type somehow or write a specialized Binder-subclass.
It's kind of strange that this seems to only affect properties; for
instance both get_Controls methods were present, but the default
GetMethod-method had no problem with that.
More information about the rdnzl-devel
mailing list