src/Mimp.SeeSharper.Reflection/TypeExtensions.Cast.cs
/// <summary>
/// Return a compiled delegate to cast a object of <paramref name="source"/> to <paramref name="destination"/>.
/// </summary>
/// <typeparam name="TDelegate"></typeparam>
/// <param name="source"></param>
/// <param name="destination"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException">If delegate has one parameter for the instance.</exception>
/// <exception cref="InvalidOperationException">If source isn't castable to destination.</exception>
Return a compiled delegate to cast a object of  to .
Return a compiled delegate to cast a object of to .
public static TDelegate GetCastDelegate<TDelegate>(this Type source, Type destination) where TDelegate : Delegate
        {
            if (source is null)
                throw new ArgumentNullException(nameof(source));
            if (destination is null)
                throw new ArgumentNullException(nameof(destination));
            return (TDelegate)source.GetCastDelegate(destination, typeof(TDelegate));
        }
public static TDelegate GetCastDelegate < TDelegate > ( this Type source , Type destination ) where TDelegate : Delegate { if ( source is null ) throw new ArgumentNullException ( nameof ( source ) ) ; if ( destination is null ) throw new ArgumentNullException ( nameof ( destination ) ) ; return ( TDelegate ) source . GetCastDelegate ( destination , typeof ( TDelegate ) ) ; }
Return a compiled delegate to cast a object of  to .
Return a compiled delegate to cast a object of to .
None
None
If delegate has one parameter for the instance.
If delegate has one parameter for the instance .
If source isn't castable to destination.
If source isn ' t castable to destination .
Type
this
<not_specific>
destination
Type
None
source
<not_specific>
None
typeparam
None