Open nesteruk opened 3 years ago
As of my understanding, the ReturnType
will always be object. After the method e.g. TryInvokeMember
has processed, the ReturnType
will be evaluated from the result
you just set in TryInvokeMember
. I think that's called dynamic. :^
Just imagine you would create a derived type of DynamicObject
and provoke TryInvokeMember
with e.g. dynObj.getNumber(5)
. Do you know what the return type will be before you call it? You as implementer of TryInvokeMember
, maybe. Another view is that you are deciding of which type the result
will be by setting it after evaluating argument list, method name and so on.
Say we define a null object like this:
And an interface like this
Calling
Null<ILog>.Instance.Warn("...")
gives an exception because inTryInvokeMember
, the value ofbinder.ReturnType
isSystem.Object
for some reason. Looks like ImpromptuInterface is failing to specifybinder.ReturnType
correctly on the basis of what the members actually are.binder.Name
is correct, though.