I have a dynamic value (implementation of IDynamicMetaObjectProvider), which I would call methods and properties.
Examples that I have found so far for calling members in dynamic value types from Microsoft.CSharp.dll, for example.
IDynamicMetaObjectProvider x = GetDynamicValue(); CallSite<Func<CallSite, object, object, object>> site = CallSite<Func<CallSite, object, object, object>>.Create( Binder.SetMember( Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags.None, "Foo", null, new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) } ) ); site.Target(site, x, 42);
I want to be able to call IDynamicMetaObjectProvider elements without using the Microsoft.CSharp.dll file. Please note that I'm not talking about using the C # dynamic keyword in everything that is related to C #, but IDynamicMetaObjectProvider is directly used.
Also note that using Reflection will not work. Reflection bypasses dynamic call binding and simply performs Reflection on the base type. I need a method that works with any implementation of IDynamicMetaObjectProvider.
source share