本文整理匯總了C#中MsgPack.Serialization.Reflection.TracingILGenerator.EmitCall方法的典型用法代碼示例。如果您正苦於以下問題:C# TracingILGenerator.EmitCall方法的具體用法?C# TracingILGenerator.EmitCall怎麽用?C# TracingILGenerator.EmitCall使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MsgPack.Serialization.Reflection.TracingILGenerator
的用法示例。
在下文中一共展示了TracingILGenerator.EmitCall方法的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 );
}
}
}
示例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 );
}
}
}