当前位置: 首页>>代码示例>>C#>>正文


C# CallSite.GetType方法代码示例

本文整理汇总了C#中System.Runtime.CompilerServices.CallSite.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CallSite.GetType方法的具体用法?C# CallSite.GetType怎么用?C# CallSite.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Runtime.CompilerServices.CallSite的用法示例。


在下文中一共展示了CallSite.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DynamicInstructionN

 public DynamicInstructionN(Type delegateType, CallSite site) {
     var methodInfo = delegateType.GetMethod("Invoke");
     _target = ReflectedCaller.Create(methodInfo);
     _targetField = site.GetType().GetField("Target");
     _site = site;
     _argCount = methodInfo.GetParameters().Length;
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:7,代码来源:DynamicInstructions.cs

示例2: DynamicInstructionN

 public DynamicInstructionN(Type delegateType, CallSite site)
 {
     MethodInfo method = delegateType.GetMethod("Invoke");
     ParameterInfo[] parameters = method.GetParameters();
     this._target = CallInstruction.Create(method, parameters);
     this._site = site;
     this._argumentCount = parameters.Length - 1;
     this._targetDelegate = site.GetType().GetField("Target").GetValue(site);
 }
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:DynamicInstructionN.cs

示例3: DynamicInstructionN

        public DynamicInstructionN(Type delegateType, CallSite site) {
            var methodInfo = delegateType.GetMethod("Invoke");
            var parameters = methodInfo.GetParameters();

            _target = CallInstruction.Create(methodInfo, parameters);
            _targetField = site.GetType().GetField("Target");
            _site = site;
            _argCount = parameters.Length;
        }
开发者ID:andreakn,项目名称:ironruby,代码行数:9,代码来源:DynamicInstructions.cs

示例4: DynamicInstructionN

        public DynamicInstructionN(Type delegateType, CallSite site) {
            var methodInfo = delegateType.GetMethod("Invoke");
            var parameters = methodInfo.GetParameters();

            // <Delegate>.Invoke is ok to target by a delegate in partial trust (SecurityException is not thrown):
            _targetInvocationInstruction = CallInstruction.Create(methodInfo, parameters);
            _site = site;
            _argumentCount = parameters.Length - 1;
            _targetDelegate = site.GetType().GetInheritedFields("Target").First().GetValue(site);
        }
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:DynamicInstructionN.cs

示例5: RewriteCallSite

        private Expression RewriteCallSite(CallSite site, TypeGen tg)
        {
            IExpressionSerializable serializer = site.Binder as IExpressionSerializable;
            if (serializer == null)
            {
                throw new ArgumentException("Generating code from non-serializable CallSiteBinder.");
            }

            Type siteType = site.GetType();

            FieldBuilder fb = tg.AddStaticField(siteType, "sf" + (_id++).ToString());
            Expression init = Expression.Call(siteType.GetMethod("Create"), serializer.CreateExpression());

            _fieldBuilders.Add(fb);
            _fieldInits.Add(init);

            Type t = init.Type;
            if (t.IsGenericType)
            {
                Type[] args = t.GetGenericArguments()[0].GetGenericArguments(); ;
                // skip the first one, it is the site.
                for (int k = 1; k < args.Length; k++)
                {
                    Type p = args[k];
                    //if (!p.Assembly.GetName().Name.Equals("mscorlib") && !p.Assembly.GetName().Name.Equals("Clojure"))
                    //    Console.WriteLine("Found {0}", p.ToString());
                }
            }

            // rewrite the node...
            return Expression.Field(null, fb);
        }
开发者ID:101v,项目名称:clojure-clr,代码行数:32,代码来源:DynInitHelper.cs


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