Ejemplo n.º 1
0
        public static TDelegate Adapt <TDelegate>(MethodInfo method)
            where TDelegate : Delegate
        {
            if (method is null)
            {
                throw new ArgumentNullException(nameof(method));
            }

            return(DelegateBuilder.Build <TDelegate>(emitter => WriteAdapter <TDelegate>(emitter, method)));
        }
Ejemplo n.º 2
0
 private static CloneDelegate <object?> BuildObjectCloneDelegate(Type type)
 => DelegateBuilder.Build <CloneDelegate <object?> >(emitter => emitter.Ldarg(0)
                                                     .UnboxOrCastclass(type)
                                                     .Call(GetCloneMethod(type))
                                                     .BoxIfNeeded(type)
                                                     .Ret());