private static Delegate CastToOriginalDelegateType(Delegate ret, Type delegateType) { return Delegate.CreateDelegate(delegateType, ret, "Invoke"); }