src/Mimp.SeeSharper.Reflection/TypeExtensions.Cast.cs
/// <summary>
/// Return a compiled function to cast a object of <paramref name="source"/> to <paramref name="destination"/>.
/// </summary>
/// <param name="source"></param>
/// <param name="destination"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException">If source isn't castable to destination.</exception>
Return a compiled function to cast a object of  to .
Return a compiled function to cast a object of to .
public static Func<object?, object?> GetCastFunc(this Type source, Type destination)
        {
            if (source is null)
                throw new ArgumentNullException(nameof(source));
            if (destination is null)
                throw new ArgumentNullException(nameof(destination));
            return source.GetCastDelegate<Func<object?, object?>>(destination);
        }
public static Func < object ? , object ? > GetCastFunc ( this Type source , Type destination ) { if ( source is null ) throw new ArgumentNullException ( nameof ( source ) ) ; if ( destination is null ) throw new ArgumentNullException ( nameof ( destination ) ) ; return source . GetCastDelegate < Func < object ? , object ? > > ( destination ) ; }
Return a compiled function to cast a object of  to .
Return a compiled function to cast a object of to .
None
None
If source isn't castable to destination.
If source isn ' t castable to destination .
Type
this
destination
Type
None
source
None