I am implementing a DynamicObject
. In the TryInvokeMethod
, in addition to the arguments ( passed in to the method), I also need the names for the parameters if they have been used.
I can see that binder.CallInfo.ArgumentNames
does indeed provides the names, but I am not able to associate them with the values. Is there any way to do so, or am I hoping against hope:
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)
{
var names = binder.CallInfo.ArgumentNames;
foreach (var arg in args)
{
arguments.Add(new Argument(arg));
}
//I need to associate the names and the args
result = this;
return true;
}
So for example if I do a call like:
myDynamicObject.DynamicInvoke("test", something: "test2")
I have test
and test2
, and also something
, but I am not able to get the information that something
was the name for test2
and test
had no name.