Exemplo n.º 1
0
        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());
        }