コード例 #1
0
 public static TDelegate?GetDelegate <TDelegate>(ConstructorInfo?constructorInfo) where TDelegate : Delegate
 => AccessTools3.GetDelegate <TDelegate>(constructorInfo);
コード例 #2
0
 /// <summary>
 /// Get a delegate for an instance method described by <paramref name="methodInfo"/> and bound to <paramref name="instance"/>.
 /// </summary>
 /// <param name="instance">The instance for which the method is defined.</param>
 /// <param name="methodInfo">The method's <see cref="MethodInfo"/>.</param>
 /// <returns>
 /// A delegate or <see langword="null"/> when <paramref name="instance"/> or <paramref name="methodInfo"/>
 /// is <see langword="null"/> or when the method cannot be found.
 /// </returns>
 public static TDelegate?GetDelegate <TDelegate>(object?instance, MethodInfo?methodInfo) where TDelegate : Delegate
 => AccessTools3.GetDelegate <TDelegate>(instance, methodInfo);
コード例 #3
0
 /// <summary>
 /// Get a delegate for a method named <paramref name="method"/>, declared by <paramref name="instance"/>'s type or any of its base types.
 /// 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="instance">The instance for which the method is defined.</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="instance"/> or <paramref name="method"/>
 /// is <see langword="null"/> or when the method cannot be found.
 /// </returns>
 public static TDelegate?GetDelegate <TDelegate, TInstance>(TInstance instance,
                                                            string method,
                                                            Type[]?parameters,
                                                            Type[]?generics = null) where TDelegate : Delegate
 => AccessTools3.GetDelegate <TDelegate, TInstance>(instance, method, parameters, generics);
コード例 #4
0
 /// <summary>
 /// Get a delegate for an instance method declared by <paramref name="instance"/>'s type or any of its base types.
 /// </summary>
 /// <param name="instance">The instance for which the method is defined.</param>
 /// <param name="method">The name of the method (case sensitive).</param>
 /// <returns>
 /// A delegate or <see langword="null"/> when <paramref name="instance"/> or <paramref name="method"/>
 /// is <see langword="null"/> or when the method cannot be found.
 /// </returns>
 public static TDelegate?GetDelegate <TDelegate, TInstance>(TInstance instance, string method) where TDelegate : Delegate
 => AccessTools3.GetDelegate <TDelegate, TInstance>(instance, method);
コード例 #5
0
 /// <summary>Get a delegate for a method described by <paramref name="methodInfo"/>.</summary>
 /// <param name="methodInfo">The method's <see cref="MethodInfo"/>.</param>
 /// <returns>A delegate or <see langword="null"/> when <paramref name="methodInfo"/> is <see langword="null"/>.</returns>
 public static TDelegate?GetDelegate <TDelegate>(MethodInfo?methodInfo) where TDelegate : Delegate
 => AccessTools3.GetDelegate <TDelegate>(methodInfo);
コード例 #6
0
 /// <summary>
 /// Get a delegate for a method named <paramref name="method"/>, declared by <paramref name="type"/> or any of its base types.
 /// </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>
 /// <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?GetDelegate <TDelegate>(Type type, string method) where TDelegate : Delegate
 => AccessTools3.GetDelegate <TDelegate>(type, method);