public static ILGenerator ReturnFromMethodOnObject(this ILGenerator generator, MethodInfo method) { if (typeof(void) == method.ReturnType) { generator.AndEmit(OpCodes.Ldnull); } else if (method.ReturnType.IsValueType) { generator.AndEmit(OpCodes.Box, method.ReturnType); } return(generator.AndReturnObject()); }
public static ILGenerator AndPushElementFromArrayAtIndexOnStackOntoStack(this ILGenerator generator) { return(generator.AndEmit(OpCodes.Ldelem_Ref)); }
public static ILGenerator AndReturnObject(this ILGenerator generator) { return(generator.AndEmit(OpCodes.Ret)); }
public static ILGenerator AndGotoLabelIfTop2ItemsOnStackAreEqual(this ILGenerator generator, Label arg) { return(generator.AndEmit(OpCodes.Beq, arg)); }
public static ILGenerator AndThrowExceptionFromStack(this ILGenerator generator) { return(generator.AndEmit(OpCodes.Throw)); }
public static ILGenerator AndPushNewObjectOntoStack(this ILGenerator generator, ConstructorInfo arg) { return(generator.AndEmit(OpCodes.Newobj, arg)); }
public static ILGenerator AndPushInt32AsInt32OntoStack(this ILGenerator generator, int arg) { return(generator.AndEmit(OpCodes.Ldc_I4, arg)); }
public static ILGenerator AndPushArrayLengthOntoStack(this ILGenerator generator) { return(generator.AndEmit(OpCodes.Ldlen)); }
public static ILGenerator AndPushArgumentSOntoStack(this ILGenerator generator) { return(generator.AndEmit(OpCodes.Ldarg_S)); }
public static ILGenerator AndInvokeMethodOnObject(this ILGenerator generator, MethodInfo method) { return(generator.AndEmit(method.IsFinal ? OpCodes.Call : OpCodes.Callvirt, method)); }
public static ILGenerator AndUnboxArgument(this ILGenerator generator, Type parameterType) { return(generator.AndEmit(OpCodes.Unbox_Any, parameterType)); }