src/Mimp.SeeSharper.Reflection/MethodInfoExtensions.cs
/// <summary>
/// Return a delegate to invoke the method.
/// </summary>
/// <typeparam name="TDelegate"></typeparam>
/// <param name="method"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException">If the delegate has no parameter for instance or the delegate hasn't equal parameter as the method.</exception>
/// <exception cref="InvalidOperationException">If the delegate types or instance type isn't castable to the method types.</exception>
Return a delegate to invoke the method.
Return a delegate to invoke the method .
public static TDelegate GetInstanceDelegate<TDelegate>(this MethodInfo method) where TDelegate : Delegate
        {
            if (method is null)
                throw new ArgumentNullException(nameof(method));
            return (TDelegate)method.GetInstanceDelegate(typeof(TDelegate));
        }
public static TDelegate GetInstanceDelegate < TDelegate > ( this MethodInfo method ) where TDelegate : Delegate { if ( method is null ) throw new ArgumentNullException ( nameof ( method ) ) ; return ( TDelegate ) method . GetInstanceDelegate ( typeof ( TDelegate ) ) ; }
Return a delegate to invoke the method.
Return a delegate to invoke the method .
None
None
If the delegate has no parameter for instance or the delegate hasn't equal parameter as the method.
If the delegate has no parameter for instance or the delegate hasn ' t equal parameter as the method .
If the delegate types or instance type isn't castable to the method types.
If the delegate types or instance type isn ' t castable to the method types .
MethodInfo
this
method
None
typeparam
None