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


C# CompilerServices.CallSite类代码示例

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


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

示例1: IOWrapper

        public IOWrapper(RubyContext/*!*/ context, object io, bool canRead, bool canWrite, bool canSeek, bool canFlush, bool canBeClosed, int bufferSize) {
            Assert.NotNull(context);

            _writeSite = CallSite<Func<CallSite, object, object, object>>.Create(
                RubyCallAction.Make(context, "write", RubyCallSignature.WithImplicitSelf(1))
            );
            _readSite = CallSite<Func<CallSite, object, object, object>>.Create(
                RubyCallAction.Make(context, "read", RubyCallSignature.WithImplicitSelf(1))
            );
            _seekSite = CallSite<Func<CallSite, object, object, object, object>>.Create(
                RubyCallAction.Make(context, "seek", RubyCallSignature.WithImplicitSelf(2))
            );
            _tellSite = CallSite<Func<CallSite, object, object>>.Create(
                RubyCallAction.Make(context, "tell", RubyCallSignature.WithImplicitSelf(0))
            );

            _obj = io;

            _canRead = canRead;
            _canWrite = canWrite;
            _canSeek = canSeek;
            _canFlush = canFlush;
            _canBeClosed = canBeClosed;
            _buffer = new byte[bufferSize];
            _writePos = 0;
            _readPos = 0;
            _readLen = 0;
        }
开发者ID:jschementi,项目名称:iron,代码行数:28,代码来源:IOWrapper.cs

示例2: 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

示例3: RubyRepresenter

        public RubyRepresenter(RubyContext/*!*/ context, Serializer/*!*/ serializer, YamlOptions/*!*/ opts)
            : base(serializer, opts) {
            _context = context;
            _objectToYamlMethod = context.GetClass(typeof(object)).ResolveMethod("to_yaml", VisibilityContext.AllVisible).Info;

             _TagUri =
                CallSite<Func<CallSite, object, object>>.Create(
                RubyCallAction.Make(context, "taguri", RubyCallSignature.WithImplicitSelf(0))
            );

            _ToYamlStyle =
                CallSite<Func<CallSite, object, object>>.Create(
                RubyCallAction.Make(context, "to_yaml_style", RubyCallSignature.WithImplicitSelf(0))
            );

            _ToYamlNode =
                CallSite<Func<CallSite, object, RubyRepresenter, object>>.Create(
                RubyCallAction.Make(context, "to_yaml_node", RubyCallSignature.WithImplicitSelf(1))
            );

            _ToYaml =
                CallSite<Func<CallSite, object, RubyRepresenter, object>>.Create(
                RubyCallAction.Make(context, "to_yaml", RubyCallSignature.WithImplicitSelf(0))
            );

            _ToYamlProperties = 
                CallSite<Func<CallSite, object, object>>.Create(
                RubyCallAction.Make(context, "to_yaml_properties", RubyCallSignature.WithImplicitSelf(0))
            );
        }
开发者ID:atczyc,项目名称:ironruby,代码行数:30,代码来源:RubyRepresenter.cs

示例4: 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

示例5: 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

示例6: 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

示例7: RubyConstructor

        public RubyConstructor(RubyGlobalScope/*!*/ scope, NodeProvider/*!*/ nodeProvider)
            : base(nodeProvider, scope) {
            
            _newSite = CallSite<Func<CallSite, RubyModule, object, object, object, object>>.Create(
                RubyCallAction.Make(scope.Context, "new", RubyCallSignature.WithImplicitSelf(3))
            ); 

            _yamlInitializeSite = CallSite<Func<CallSite, object, object, Hash, object>>.Create(
                RubyCallAction.Make(scope.Context, "yaml_initialize", RubyCallSignature.WithImplicitSelf(3))
            );
        }
开发者ID:atczyc,项目名称:ironruby,代码行数:11,代码来源:RubyConstructor.cs

示例8: Invoke

        internal object Invoke(object[] args) {
            Debug.Assert(args != null);

            // If it is a delegate, just let DynamicInvoke do the binding.
            var d = _callable as Delegate;
            if (d != null) {
                return d.DynamicInvoke(args);
            }

            // Otherwise, create a CallSite and invoke it.
            if (_site == null) {
                _site = CallSite<Func<CallSite, object, object[], object>>.Create(SplatInvokeBinder.Instance);
            }

            return _site.Target(_site, _callable, args);
        }
开发者ID:apboyle,项目名称:ironruby,代码行数:16,代码来源:SplatCallSite.cs

示例9: CastToPath

 /// <summary>
 /// Converts an object to string using to_path-to_str protocol.
 /// Protocol:
 /// ? to_path => to_path() and to_str conversion on the result
 /// ? to_str => to_str()
 /// </summary>
 public static MutableString/*!*/ CastToPath(CallSite<Func<CallSite, object, MutableString>>/*!*/ toPath, object obj) {
     MutableString result = toPath.Target(toPath, obj);
     if (result == null) {
         throw RubyExceptions.CreateTypeConversionError("nil", "String");
     }
     return result;
 }
开发者ID:nieve,项目名称:ironruby,代码行数:13,代码来源:Protocols.cs

示例10: FinalizerInvoker

 public FinalizerInvoker(CallSite<Func<CallSite, object, object, object>>/*!*/ callSite, object finalizer)
 {
     Assert.NotNull(callSite);
     _callSite = callSite;
     _finalizer = finalizer;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:6,代码来源:ObjectSpace.cs

示例11: defaultdict

 public defaultdict(CodeContext/*!*/ context) {
     _missingSite = CallSite<Func<CallSite, CodeContext, object, object>>.Create(
         new PythonInvokeBinder(
             PythonContext.GetContext(context),
             new CallSignature(0)
         )
     );
 }
开发者ID:jschementi,项目名称:iron,代码行数:8,代码来源:_collections.cs

示例12: LessThanObjUInt

		public static object LessThanObjUInt (CallSite site, object a, uint b)
		{
#if BINDERS_RUNTIME_STATS
			Stats.Increment(StatsCounter.BinaryOperationBinderInvoked);
#endif
			if (a is uint)
			{
				return (uint)a < b;
			}
			if ((a == null) || (a == PlayScript.Undefined._undefined))
			{
				return false;
			}
			return Convert.ToDouble(a) < (double)b;
		}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:15,代码来源:CSharpBinaryOperationBinder2.cs

示例13: ShiftRightDoubleObj

		public static object ShiftRightDoubleObj (CallSite site, double a, object b)
		{
#if BINDERS_RUNTIME_STATS
			Stats.Increment(StatsCounter.BinaryOperationBinderInvoked);
#endif
			if ((b == null) || (b == PlayScript.Undefined._undefined))
			{
				return a;
			}
			return (int)a >> Convert.ToInt32(b);
		}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:11,代码来源:CSharpBinaryOperationBinder2.cs

示例14: XorObjBool

		public static object XorObjBool (CallSite site, object a, bool b)
		{
#if BINDERS_RUNTIME_STATS
			Stats.Increment(StatsCounter.BinaryOperationBinderInvoked);
#endif
			return Dynamic.CastObjectToBool(a) ^ b;
		}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:7,代码来源:CSharpBinaryOperationBinder2.cs

示例15: XorUIntObj

		public static object XorUIntObj (CallSite site, uint a, object b)
		{
#if BINDERS_RUNTIME_STATS
			Stats.Increment(StatsCounter.BinaryOperationBinderInvoked);
#endif
			if ((b == null) || (b == PlayScript.Undefined._undefined))
			{
				return a;
			}
			return a ^ Convert.ToUInt32(b);
		}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:11,代码来源:CSharpBinaryOperationBinder2.cs


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