Пример #1
0
 /// <summary>
 /// Require that the given value is null. If 'value' is not null, throws an exception of
 /// the given type.
 /// </summary>
 /// <typeparam name="TException">The type of the exception to throw.</typeparam>
 /// <param name="value">The value that must not be null.</param>
 public static void IsNull <TException>(object value)
     where TException : Exception, new()
 {
     Precond.Requires <TException>(value == null);
 }
Пример #2
0
 /// <summary>
 /// Require that the given value is null. If 'value' is not null, throws an exception of
 /// the given type.
 /// </summary>
 /// <typeparam name="TException">The type of the exception to throw.</typeparam>
 /// <param name="value">The value that must not be null.</param>
 /// <param name="message">A message included if the exception is thrown.</param>
 public static void IsNull <TException>(object value, string message)
     where TException : Exception, new()
 {
     Precond.Requires <TException>(value == null, message);
 }
Пример #3
0
 /// <summary>
 /// Require that the given value is null. If 'value' is not null, throws an
 /// InvalidOperationException.
 /// </summary>
 /// <param name="value">value that must not be null.</param>
 /// <param name="message">A message included if the exception is thrown.</param>
 public static void IsNull(object value, string message)
 {
     Precond.Requires <InvalidOperationException>(value == null, message);
 }
Пример #4
0
 /// <summary>
 /// Require that the given value is null. If 'value' is not null, throws an
 /// InvalidOperationException.
 /// </summary>
 /// <param name="value">Value that must be null.</param>
 public static void IsNull(object value)
 {
     Precond.Requires <InvalidOperationException>(value == null);
 }
Пример #5
0
 /// <summary>
 /// Require that the given value is not null. If 'value' is null, throws an
 /// ArgumentNullException.
 /// </summary>
 /// <param name="value">value that must not be null.</param>
 /// <param name="paramName">name of the parameter that holds 'value'.</param>
 public static void IsNotNull(object value, string paramName)
 {
     Precond.Requires <ArgumentNullException>(value != null, paramName);
 }
Пример #6
0
 /// <summary>
 /// Require that the given value is not null. If 'value' is null, throws an
 /// ArgumentNullException.
 /// </summary>
 /// <param name="value">Value that must not be null.</param>
 public static void IsNotNull(object value)
 {
     Precond.Requires <ArgumentNullException>(value != null);
 }
Пример #7
0
 /// <summary>
 /// Require that the given predicate is true. If 'predicate' is false, throws an
 /// InvalidOperationException.
 /// </summary>
 /// <param name="predicate">The bool that must be true.</param>
 public static void Requires(bool predicate, string message)
 {
     Precond.Requires <InvalidOperationException>(predicate, message);
 }