Exemplo n.º 1
0
 /// <summary>
 /// Gets static field.
 /// </summary>
 /// <param name="fieldName">Name of field.</param>
 /// <param name="nonPublic"><see langword="true"/> to reflect non-public field.</param>
 /// <returns>Instance field.</returns>
 /// <exception cref="MissingEventException">Field doesn't exist.</exception>
 public static Reflection.Field <V> RequireStatic(string fieldName, bool nonPublic = false)
 => GetStatic(fieldName, nonPublic) ?? throw MissingFieldException.Create <T, V>(fieldName);
Exemplo n.º 2
0
 /// <summary>
 /// Reflects static property.
 /// </summary>
 /// <param name="propertyName">Name of property.</param>
 /// <param name="nonPublic">True to reflect non-public property.</param>
 /// <returns>Instance property.</returns>
 /// <exception cref="MissingPropertyException">Property doesn't exist.</exception>
 public static Reflection.Property <V> RequireStatic(string propertyName, bool nonPublic = false)
 => GetStatic(propertyName, nonPublic) ?? throw MissingFieldException.Create <T, V>(propertyName);
Exemplo n.º 3
0
 /// <summary>
 /// Gets instance field.
 /// </summary>
 /// <param name="fieldName">Name of field.</param>
 /// <param name="nonPublic"><see langword="true"/> to reflect non-public field.</param>
 /// <returns>Instance field.</returns>
 /// <exception cref="MissingEventException">Field doesn't exist.</exception>
 public static Field <T, V> Require(string fieldName, bool nonPublic = false)
 => Get(fieldName, nonPublic) ?? throw MissingFieldException.Create <T, V>(fieldName);