コード例 #1
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <typeparam name="TException">Type of condition to by thrown.</typeparam>
 /// <param name="condition">The conditional expression to test.</param>
 /// <param name="args">An object array that contains zero or more objects to format.</param>
 public static void Requires <TException>(Func <bool> condition, params object[] args) where TException : Exception => ContractOperations.Requires <TException>(condition, args);
コード例 #2
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <typeparam name="TException">Type of condition to by thrown.</typeparam>
 /// <param name="condition">The conditional expression to test.</param>
 public static void Requires <TException>(Func <bool> condition) where TException : Exception => ContractOperations.Requires <TException>(condition, StringConstants.MessageRequiresError);
コード例 #3
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <typeparam name="TException">Type of condition to by thrown.</typeparam>
 /// <param name="condition">The conditional expression to test.</param>
 /// <param name="message">The message that describes the error.</param>
 public static void Requires <TException>(Func <bool> condition, string message) where TException : Exception => ContractOperations.Requires <TException>(condition, message);
コード例 #4
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <param name="condition">The conditional expression to test.</param>
 public static void Requires(bool condition) => ContractOperations.Requires <Exception>(() => condition, StringConstants.MessageRequiresError);
コード例 #5
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <param name="condition">The conditional expression to test.</param>
 /// <param name="message">The message that describes the error.</param>
 public static void Requires(Func <bool> condition, string message) => ContractOperations.Requires <Exception>(condition, message);
コード例 #6
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <param name="condition">The conditional expression to test.</param>
 public static void Ensures(Func <bool> condition) => ContractOperations.Ensures <Exception>(condition, StringConstants.MessageRequiresError);
コード例 #7
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <typeparam name="TException">Type of condition to by thrown.</typeparam>
 /// <param name="condition">The conditional expression to test.</param>
 /// <param name="args">An object array that contains zero or more objects to format.</param>
 public static void Ensures <TException>(bool condition, params object[] args) where TException : Exception => ContractOperations.Ensures <TException>(() => condition, args);
コード例 #8
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <typeparam name="TException">Type of condition to by thrown.</typeparam>
 /// <param name="condition">The conditional expression to test.</param>
 /// <param name="message">The message that describes the error.</param>
 public static void Ensures <TException>(bool condition, string message) where TException : Exception => ContractOperations.Ensures <TException>(() => condition, message);
コード例 #9
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <typeparam name="TException">Type of condition to by thrown.</typeparam>
 /// <param name="condition">The conditional expression to test.</param>
 public static void Ensures <TException>(bool condition) where TException : Exception => ContractOperations.Ensures <TException>(() => condition, StringConstants.MessageRequiresError);
コード例 #10
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <param name="condition">The conditional expression to test.</param>
 /// /// <param name="message">The message that describes the error.</param>
 public static void Ensures(bool condition, string message) => ContractOperations.Ensures <Exception>(() => condition, message);