<PackageReference Include="Microsoft.CSharp" Version="4.5.0-rc1" />

CSharpInvokeBinder

using System; using System.Collections.Generic; using System.Dynamic; namespace Microsoft.CSharp.RuntimeBinder { internal sealed class CSharpInvokeBinder : InvokeBinder, ICSharpInvokeOrInvokeMemberBinder { private CSharpCallFlags _flags; private Type _callingContext; private List<CSharpArgumentInfo> _argumentInfo; private RuntimeBinder _binder; bool ICSharpInvokeOrInvokeMemberBinder.StaticCall { get { if (_argumentInfo[0] != null) return _argumentInfo[0].IsStaticType; return false; } } string ICSharpInvokeOrInvokeMemberBinder.Name { get { return "Invoke"; } } IList<Type> ICSharpInvokeOrInvokeMemberBinder.TypeArguments { get { return Array.Empty<Type>(); } } CSharpCallFlags ICSharpInvokeOrInvokeMemberBinder.Flags { get { return _flags; } } Type ICSharpInvokeOrInvokeMemberBinder.CallingContext { get { return _callingContext; } } IList<CSharpArgumentInfo> ICSharpInvokeOrInvokeMemberBinder.ArgumentInfo { get { return _argumentInfo.AsReadOnly(); } } bool ICSharpInvokeOrInvokeMemberBinder.ResultDiscarded { get { return (_flags & CSharpCallFlags.ResultDiscarded) != CSharpCallFlags.None; } } public CSharpInvokeBinder(CSharpCallFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo) : base(BinderHelper.CreateCallInfo(argumentInfo, 1)) { _flags = flags; _callingContext = callingContext; _argumentInfo = BinderHelper.ToList(argumentInfo); _binder = RuntimeBinder.GetInstance(); } public override DynamicMetaObject FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion) { return BinderHelper.Bind(this, _binder, BinderHelper.Cons(target, args), _argumentInfo, errorSuggestion); } } }