/// <summary> /// Get a delegate for a method named <paramref name="method"/>, directly declared by <paramref name="type"/>, /// and then bind it to an instance type of <see cref="object"/>. /// </summary> /// <param name="type">The type where the method is declared.</param> /// <param name="method">The name of the method (case sensitive).</param> /// <returns> /// A delegate or <see langword="null"/> when <paramref name="type"/> or <paramref name="method"/> /// is <see langword="null"/> or when the method cannot be found. /// </returns> public static TDelegate?GetDeclaredDelegateObjectInstance <TDelegate>(Type type, string method) where TDelegate : Delegate => AccessTools3.GetDeclaredDelegateObjectInstance <TDelegate>(type, method);
/// <summary> /// Get a delegate for a method named <paramref name="method"/>, directly declared by <paramref name="type"/>, /// and then bind it to an instance type of <see cref="object"/>. /// Choose the overload with the given <paramref name="parameters"/> if not <see langword="null"/> /// and/or the generic arguments <paramref name="generics"/> if not <see langword="null"/>. /// </summary> /// <param name="type">The type from which to start searching for the method's definition.</param> /// <param name="method">The name of the method (case sensitive).</param> /// <param name="parameters">The method's parameter types (when not <see langword="null"/>).</param> /// <param name="generics">The generic arguments of the method (when not <see langword="null"/>).</param> /// <returns> /// A delegate or <see langword="null"/> when <paramref name="type"/> or <paramref name="method"/> /// is <see langword="null"/> or when the method cannot be found. /// </returns> public static TDelegate?GetDeclaredDelegateObjectInstance <TDelegate>(Type type, string method, Type[]?parameters, Type[]?generics = null) where TDelegate : Delegate => AccessTools3.GetDeclaredDelegateObjectInstance <TDelegate>(type, method, parameters, generics);