Esempio n. 1
0
 /// <summary>
 /// Reflects constructor of type <typeparamref name="T"/> which signature
 /// is specified by delegate type.
 /// </summary>
 /// <param name="nonPublic"><see langword="true"/> to reflect non-public constructor.</param>
 /// <typeparam name="D">Type of delegate describing constructor signature.</typeparam>
 /// <returns>Reflected constructor.</returns>
 /// <exception cref="MissingConstructorException">Constructor doesn't exist.</exception>
 public static Reflection.Constructor <D> Require <D>(bool nonPublic = false)
     where D : MulticastDelegate
 => Get <D>(nonPublic) ?? throw MissingConstructorException.Create <D>();
Esempio n. 2
0
 /// <summary>
 /// Returns public constructor of type <typeparamref name="T"/> without parameters.
 /// </summary>
 /// <param name="nonPublic"><see langword="true"/> to reflect non-public constructor.</param>
 /// <returns>Reflected constructor without parameters.</returns>
 /// <exception cref="MissingConstructorException">Constructor doesn't exist.</exception>
 public static Reflection.Constructor <Func <T> > Require(bool nonPublic = false)
 => Get(nonPublic) ?? throw MissingConstructorException.Create <Func <T> >();
Esempio n. 3
0
 /// <summary>
 /// Reflects constructor as function.
 /// </summary>
 /// <param name="nonPublic"><see langword="true"/> to reflect non-public constructor.</param>
 /// <typeparam name="A">A structure describing constructor signature.</typeparam>
 /// <returns>Constructor for type <typeparamref name="T"/>.</returns>
 /// <exception cref="MissingConstructorException">Constructor doesn't exist.</exception>
 public static Reflection.Constructor <Function <A, T> > RequireConstructor <A>(bool nonPublic = false)
     where A : struct
 => GetConstructor <A>(nonPublic) ?? throw MissingConstructorException.Create <T, A>();