當前位置: 首頁>>代碼示例>>C#>>正文


C# Dynamic.CallInfo類代碼示例

本文整理匯總了C#中System.Dynamic.CallInfo的典型用法代碼示例。如果您正苦於以下問題:C# CallInfo類的具體用法?C# CallInfo怎麽用?C# CallInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CallInfo類屬於System.Dynamic命名空間,在下文中一共展示了CallInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BindComInvoke

        private DynamicMetaObject BindComInvoke(DynamicMetaObject[] args, ComMethodDesc method, CallInfo callInfo, bool[] isByRef,
            List<ParameterExpression> temps, List<Expression> initTemps)
        {
            DynamicMetaObject invoke = new ComInvokeBinder(
                callInfo,
                args,
                isByRef,
                IDispatchRestriction(),
                Expression.Constant(method),
                Expression.Property(
                    Helpers.Convert(Expression, typeof(IDispatchComObject)),
                    typeof(IDispatchComObject).GetProperty("DispatchObject")
                ),
                method
            ).Invoke();

            if ((temps != null) && (temps.Any()))
            {
                Expression invokeExpression = invoke.Expression;
                Expression call = Expression.Block(invokeExpression.Type, temps, initTemps.Append(invokeExpression));
                invoke = new DynamicMetaObject(call, invoke.Restrictions);
            }

            return invoke;
        }
開發者ID:40a,項目名稱:PowerShell,代碼行數:25,代碼來源:IDispatchMetaObject.cs

示例2: TotemSetIndexBinder

        public TotemSetIndexBinder(TotemContext /*!*/ context, CallInfo callInfo)
            : base(callInfo)
        {
            Assert.NotNull(context);

            _context = context;
        }
開發者ID:Alxandr,項目名稱:IronTotem,代碼行數:7,代碼來源:TotemSetIndexBinder.cs

示例3: Bind

            public static DynamicMetaObject/*!*/ Bind(string/*!*/ methodName, CallInfo/*!*/ callInfo,
                DynamicMetaObjectBinder/*!*/ binder, DynamicMetaObject/*!*/ target, DynamicMetaObject/*!*/[]/*!*/ args,
                Func<DynamicMetaObject, DynamicMetaObject[], DynamicMetaObject>/*!*/ fallback)
            {
                Debug.Assert(fallback != null);

                //create DMO
                var phpInvokeBinder = Binder.MethodCall(methodName, 0, callInfo.ArgumentCount, null, Types.Object[0]) as PhpBaseInvokeMemberBinder;

                if (phpInvokeBinder != null)
                {

                    //Add ScriptContext.CurrentContext
                    var context = new DynamicMetaObject(Expression.Call(Methods.ScriptContext.GetCurrentContext), BindingRestrictions.Empty);

                    var restrictions = BinderHelper.GetSimpleInvokeRestrictions(target, args);

                    //Value type arguments have to be boxed
                    DynamicMetaObject[] arguments = new DynamicMetaObject[1 + args.Length];
                    arguments[0] = context;
                    for (int i = 0; i < args.Length; ++i)
                        arguments[1 + i] = new DynamicMetaObject(WrapDynamic(args[i].Expression),
                                                                 args[i].Restrictions);
                    var result = phpInvokeBinder.Bind(target, arguments);

                    //Unwrap result
                    var res = new DynamicMetaObject(Unwrap(result.Expression), restrictions);

                    return res;
                }
                else
                    return fallback(target, args);//this will never happen
            }
開發者ID:dw4dev,項目名稱:Phalanger,代碼行數:33,代碼來源:InteropBinder.cs

示例4: CreateCall

        /// <summary>
        /// Creates the cacheable method or indexer or property call.
        /// </summary>
        /// <param name="kind">The kind.</param>
        /// <param name="name">The name.</param>
        /// <param name="callInfo">The callInfo.</param>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public static CacheableInvocation CreateCall(InvocationKind kind, String_OR_InvokeMemberName name = null, CallInfo callInfo = null,object context = null)
        {
            var tArgCount = callInfo != null ? callInfo.ArgumentCount : 0;
            var tArgNames = callInfo != null ? callInfo.ArgumentNames.ToArray() : null;

            return new CacheableInvocation(kind, name, tArgCount, tArgNames, context);
        }
開發者ID:bbenzikry,項目名稱:impromptu-interface,代碼行數:15,代碼來源:CacheableInvocation.cs

示例5: ComInvokeBinder

        internal ComInvokeBinder(
                CallInfo callInfo, 
                DynamicMetaObject[] args,
                bool[] isByRef,
                BindingRestrictions restrictions, 
                Expression method, 
                Expression dispatch, 
                ComMethodDesc methodDesc
                )
        {
            Debug.Assert(callInfo != null, "arguments");
            Debug.Assert(args != null, "args");
            Debug.Assert(isByRef != null, "isByRef");
            Debug.Assert(method != null, "method");
            Debug.Assert(dispatch != null, "dispatch");

            Debug.Assert(TypeUtils.AreReferenceAssignable(typeof(ComMethodDesc), method.Type), "method");
            Debug.Assert(TypeUtils.AreReferenceAssignable(typeof(IDispatch), dispatch.Type), "dispatch");

            _method = method;
            _dispatch = dispatch;
            _methodDesc = methodDesc;

            _callInfo = callInfo;
            _args = args;
            _isByRef = isByRef;
            _restrictions = restrictions;

            // Set Instance to some value so that CallBinderHelper has the right number of parameters to work with
            _instance = dispatch;
        }
開發者ID:TerabyteX,項目名稱:main,代碼行數:31,代碼來源:ComInvokeBinder.cs

示例6: New

 public static InvokeMemberBinder New(
     StaticMetaTables metaTables, 
     string name, 
     CallInfo info)
 {
     return new InvokeMemberBinder(metaTables, name, info);
 }
開發者ID:jeffpanici75,項目名稱:Tsuki,代碼行數:7,代碼來源:InvokeMemberBinder.cs

示例7: GetIndexBinder

 public GetIndexBinder(
     StaticMetaTables metaTables,
     CallInfo callInfo)
     : base(callInfo)
 {
     _metaTables = metaTables;
 }
開發者ID:jeffpanici75,項目名稱:Tsuki,代碼行數:7,代碼來源:GetIndexBinder.cs

示例8: CreateNodes

        static IReadOnlyList<IMemberDefinition> CreateNodes(CallInfo callInfo, IReadOnlyList<object> args)
        {
            var result = new List<IMemberDefinition>();

            int difference;
            var nameCount = callInfo.ArgumentNames.Count;
            var argumentCount = args.Count;

            if (argumentCount != nameCount)
            {
                if (nameCount != args.Count(x => !(x is IMemberDefinition)))
                    throw new NotSupportedException("Unnamed arguments must be MemberDefinition instances.");

                difference = argumentCount - nameCount;
            }
            else
            {
                difference = 0;
            }

            var argumentNames = callInfo.ArgumentNames;

            for (var i = argumentCount - 1; i >= 0; i--)
            {
                var argument = args[i];

                var dynamicMember = argument as IMemberDefinition;
                if (dynamicMember == null)
                {
                    var name = argumentNames[i - difference];

                    var @delegate = argument as Delegate;
                    if (@delegate != null)
                    {
                        dynamicMember = MemberDefinition.Method(name, @delegate);
                    }
                    else
                    {
                        var type = argument as Type;

                        if (type == null)
                            throw new NotSupportedException("Definitions require a type.");

                        if (typeof(Delegate).IsAssignableFrom(type))
                        {
                            dynamicMember = MemberDefinition.EmptyMethod(name, type);
                        }
                        else
                        {
                            dynamicMember = MemberDefinition.Property(name, type);
                        }
                    }
                }

                result.Add(dynamicMember);   
            }

            return result;
        }
開發者ID:StevenThuriot,項目名稱:Horizon.Forge,代碼行數:59,代碼來源:TypeFactory.cs

示例9: InvokeMemberBinder

 public InvokeMemberBinder(
     StaticMetaTables metaTables, 
     string name, 
     CallInfo callInfo)
     : base(name, false, callInfo)
 {
     _metaTables = metaTables;
 }
開發者ID:jeffpanici75,項目名稱:Tsuki,代碼行數:8,代碼來源:InvokeMemberBinder.cs

示例10: InvokeMemberBinder

        /// <summary>
        /// Initializes a new instance of the <see cref="InvokeMemberBinder" />.
        /// </summary>
        /// <param name="name">The name of the member to invoke.</param>
        /// <param name="ignoreCase">true if the name should be matched ignoring case; false otherwise.</param>
        /// <param name="callInfo">The signature of the arguments at the call site.</param>
        protected InvokeMemberBinder(string name, bool ignoreCase, CallInfo callInfo) {
            ContractUtils.RequiresNotNull(name, "name");
            ContractUtils.RequiresNotNull(callInfo, "callInfo");

            _name = name;
            _ignoreCase = ignoreCase;
            _callInfo = callInfo;
        }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:14,代碼來源:InvokeMemberBinder.cs

示例11: InvokeMemberBinder

        /// <summary>
        /// Initializes a new instance of the <see cref="InvokeMemberBinder" />.
        /// </summary>
        /// <param name="name">The name of the member to invoke.</param>
        /// <param name="ignoreCase">true if the name should be matched ignoring case; false otherwise.</param>
        /// <param name="callInfo">The signature of the arguments at the call site.</param>
        protected InvokeMemberBinder(string name, bool ignoreCase, CallInfo callInfo)
        {
            ContractUtils.RequiresNotNull(name, nameof(name));
            ContractUtils.RequiresNotNull(callInfo, nameof(callInfo));

            Name = name;
            IgnoreCase = ignoreCase;
            CallInfo = callInfo;
        }
開發者ID:dotnet,項目名稱:corefx,代碼行數:15,代碼來源:InvokeMemberBinder.cs

示例12: BindGetOrInvoke

        private DynamicMetaObject BindGetOrInvoke(DynamicMetaObject[] args, CallInfo callInfo) {
            ComMethodDesc method;
            var target = _callable.DispatchComObject;
            var name = _callable.MemberName;

            if (target.TryGetMemberMethod(name, out method) ||
                target.TryGetMemberMethodExplicit(name, out method)) {

                bool[] isByRef = ComBinderHelpers.ProcessArgumentsForCom(ref args);
                return BindComInvoke(method, args, callInfo, isByRef);
            }
            return null;
        }
開發者ID:rudimk,項目名稱:dlr-dotnet,代碼行數:13,代碼來源:DispCallableMetaObject.cs

示例13: BindComInvoke

 private DynamicMetaObject BindComInvoke(DynamicMetaObject[] args, ComMethodDesc method, CallInfo callInfo, bool[] isByRef) {
     return new ComInvokeBinder(
         callInfo,
         args,
         isByRef,
         IDispatchRestriction(),
         Expression.Constant(method),
         Expression.Property(
             Helpers.Convert(Expression, typeof(IDispatchComObject)),
             typeof(IDispatchComObject).GetProperty("DispatchObject")
         ),
         method
     ).Invoke();
 }
開發者ID:jcteague,項目名稱:ironruby,代碼行數:14,代碼來源:IDispatchMetaObject.cs

示例14: CopyBackArguments

 public static void CopyBackArguments(CallInfo callInfo, object[] packedArgs, object[] args)
 {
     if (packedArgs != args)
     {
         int length = packedArgs.Length;
         int argumentCount = callInfo.ArgumentCount;
         int num3 = length - callInfo.ArgumentNames.Count;
         int num5 = length - 1;
         for (int i = 0; i <= num5; i++)
         {
             args[i] = packedArgs[(i < argumentCount) ? ((i + num3) % argumentCount) : i];
         }
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:14,代碼來源:IDOUtils.cs

示例15: BindComInvoke

        private DynamicMetaObject BindComInvoke(ComMethodDesc method, DynamicMetaObject[] indexes, CallInfo callInfo, bool[] isByRef) {
            var callable = Expression;
            var dispCall = Helpers.Convert(callable, typeof(DispCallable));

            return new ComInvokeBinder(
                callInfo,
                indexes,
                isByRef,
                DispCallableRestrictions(),
                Expression.Constant(method),
                Expression.Property(
                    dispCall,
                    typeof(DispCallable).GetProperty("DispatchObject")
                ),
                method
            ).Invoke();
        }
開發者ID:rudimk,項目名稱:dlr-dotnet,代碼行數:17,代碼來源:DispCallableMetaObject.cs


注:本文中的System.Dynamic.CallInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。