src/Mimp.SeeSharper.Reflection/TypeExtensions.Constructor.cs
/// <summary>
/// Return a compiled delegate to invoke the constructor with same parameters like <paramref name="delegateType"/>.
/// </summary>
/// <param name="type"></param>
/// <param name="delegateType"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException">If no matching constructor exists.</exception>
Return a compiled delegate to invoke the constructor with same parameters like .
Return a compiled delegate to invoke the constructor with same parameters like .
public static Delegate GetNewDelegate(this Type type, Type delegateType)
        {
            if (type is null)
                throw new ArgumentNullException(nameof(type));
            if (delegateType is null)
                throw new ArgumentNullException(nameof(delegateType));
            return type.GetSingleConstructor(delegateType.GetDelegateParameterTypes()).GetDelegate(delegateType);
        }
public static Delegate GetNewDelegate ( this Type type , Type delegateType ) { if ( type is null ) throw new ArgumentNullException ( nameof ( type ) ) ; if ( delegateType is null ) throw new ArgumentNullException ( nameof ( delegateType ) ) ; return type . GetSingleConstructor ( delegateType . GetDelegateParameterTypes ( ) ) . GetDelegate ( delegateType ) ; }
Return a compiled delegate to invoke the constructor with same parameters like .
Return a compiled delegate to invoke the constructor with same parameters like .
None
None
If no matching constructor exists.
If no matching constructor exists .
Type
this
delegateType
Type
None
type
None