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))); }
private static CloneDelegate <object?> BuildObjectCloneDelegate(Type type) => DelegateBuilder.Build <CloneDelegate <object?> >(emitter => emitter.Ldarg(0) .UnboxOrCastclass(type) .Call(GetCloneMethod(type)) .BoxIfNeeded(type) .Ret());