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


C# TracingILGenerator.EmitCallvirt方法代码示例

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


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

示例1: Invoke

		private void Invoke( TracingILGenerator il )
		{
			ConstructorInfo asConsctructor;
			if ( ( asConsctructor = this._method as ConstructorInfo ) != null )
			{
				if ( asConsctructor.DeclaringType.GetIsValueType() )
				{
					this._target.LoadValue( il, true );
					foreach ( var argument in this._arguments )
					{
						argument.LoadValue( il, false );
					}

					il.EmitCallConstructor( asConsctructor );

					// For compatibility to ref type.
					this._target.LoadValue( il, false );
				}
				else
				{
					foreach ( var argument in this._arguments )
					{
						argument.LoadValue( il, false );
					}

					il.EmitNewobj( asConsctructor );
				}
			}
			else
			{
				// method
				if ( !this._method.IsStatic )
				{
					this._target.LoadValue( il, this._target.ContextType.ResolveRuntimeType().GetIsValueType() );
				}

				foreach ( var argument in this._arguments )
				{
					argument.LoadValue( il, false );
				}

				if ( this._method.IsStatic || this._target.ContextType.ResolveRuntimeType().GetIsValueType() )
				{
					il.EmitCall( this._method as MethodInfo );
				}
				else if ( this._interface != null )
				{
					// Explicit interface impl
					il.EmitCallvirt(
						this._interface.GetRuntimeMethod(
							this._method.Name.Substring( this._method.Name.LastIndexOf( '.' ) + 1 ),
							this._method.GetParameterTypes()
						)
					);
				}
				else
				{
					il.EmitCallvirt( this._method as MethodInfo );
				}
			}
		}
开发者ID:msgpack,项目名称:msgpack-cli,代码行数:61,代码来源:InvocationILConsruct.cs

示例2: Invoke

		private void Invoke( TracingILGenerator il )
		{
			ConstructorInfo asConsctructor;
			if ( ( asConsctructor = this._method as ConstructorInfo ) != null )
			{
				if ( asConsctructor.DeclaringType.GetIsValueType() )
				{
					this._target.LoadValue( il, true );
					foreach ( var argument in this._arguments )
					{
						argument.LoadValue( il, false );
					}

					il.EmitCallConstructor( asConsctructor );

					// For compatibility to ref type.
					this._target.LoadValue( il, false );
				}
				else
				{
					foreach ( var argument in this._arguments )
					{
						argument.LoadValue( il, false );
					}

					il.EmitNewobj( asConsctructor );
				}
			}
			else
			{
				// method
				if ( !this._method.IsStatic )
				{
					this._target.LoadValue( il, this._target.ContextType.GetIsValueType() );
				}

				foreach ( var argument in this._arguments )
				{
					argument.LoadValue( il, false );
				}

				if ( this._method.IsStatic || this._target.ContextType.GetIsValueType() )
				{
					il.EmitCall( this._method as MethodInfo );
				}
				else
				{
					il.EmitCallvirt( this._method as MethodInfo );
				}
			}
		}
开发者ID:gezidan,项目名称:ZYSOCKET,代码行数:51,代码来源:InvocationILConsruct.cs


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