• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Dynamic.CallInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Dynamic.CallInfo的典型用法代码示例。如果您正苦于以下问题:C# CallInfo类的具体用法?C# CallInfo怎么用?C# CallInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CallInfo类属于System.Dynamic命名空间,在下文中一共展示了CallInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: 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))
            {
                List<ParameterExpression> temps = new List<ParameterExpression>();
                List<Expression> initTemps = new List<Expression>();

                bool[] isByRef = ComBinderHelpers.ProcessArgumentsForCom(method, ref args, temps, initTemps);
                return BindComInvoke(method, args, callInfo, isByRef, temps, initTemps);
            }
            return null;
        }
开发者ID:40a,项目名称:PowerShell,代码行数:17,代码来源:DispCallableMetaObject.cs


示例17: ParseNamedArgumentValues

        private void ParseNamedArgumentValues(CallInfo callInfo, object[] args)
        {
            if (!callInfo.ArgumentNames.Any())
            {
                throw new ArgumentException("No names were specified for the values provided. When using the named arguments (With()) syntax, you should specify the items to be set as argument names, such as With(customerId: customerId).");
            }

            if (callInfo.ArgumentNames.Count() != args.Length)
            {
                throw new ArgumentException("One or more arguments are missing a name. Names should be specified with C# named argument syntax, e.g. With(customerId: customerId).");
            }

            var argumentIndex = 0;
            foreach (var argumentName in callInfo.ArgumentNames.Select(ToCamelCase))
            {
                argumentStore.SetMemberNameAndValue(argumentName, args[argumentIndex++]);
            }
        }
开发者ID:fffej,项目名称:BobTheBuilder,代码行数:18,代码来源:NamedArgumentsSyntaxParser.cs


示例18: BindGetOrInvoke

        private DynamicMetaObject BindGetOrInvoke(DynamicMetaObject[] args, CallInfo callInfo) {
            //
            // Demand Full Trust to proceed with the binding.
            //

            new PermissionSet(PermissionState.Unrestricted).Demand();

            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:jcteague,项目名称:ironruby,代码行数:19,代码来源:DispCallableMetaObject.cs


示例19: CreateValueNodes

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

            int difference;
            var nameCount = callInfo.ArgumentNames.Count;
            var argumentCount = args.Count;
            if (argumentCount != nameCount)
            {
                if (nameCount != args.Count(x => !(x is Member)))
                    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 Member;
                if (dynamicMember == null)
                {
                    var name = argumentNames[i - difference];
                    dynamic value = argument;
                    dynamicMember = Member.Unknown(name, value);
                }

                result.Add(dynamicMember);
            }

            return result;
        }
开发者ID:StevenThuriot,项目名称:Horizon.Forge,代码行数:38,代码来源:TypeFactory.cs


示例20: LuaInvokeMemberBinder

 public LuaInvokeMemberBinder(LuaContext context, string name, CallInfo callInfo)
     : base(name, false, callInfo)
 {
     ContractUtils.RequiresNotNull(context, "context");
     this.context = context;
 }
开发者ID:fgretief,项目名称:IronLua,代码行数:6,代码来源:LuaInvokeMemberBinder.cs



注:本文中的System.Dynamic.CallInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Dynamic.ConvertBinder类代码示例发布时间:2022-05-26
下一篇:
C# Dynamic.BindingRestrictions类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap