12345678910111213141516171819202122232425262728293031323334 |
- using System;
- namespace PaySharp.Alipay.Util
- {
- /// <summary>
- /// 参数校验类
- /// </summary>
- public class ArgumentValidator
- {
- public static void CheckArgument(bool expression, string errorMessage)
- {
- if (!expression)
- {
- throw new Exception(errorMessage);
- }
- }
- public static void CheckNotNull(object value, string errorMessage)
- {
- if (value == null)
- {
- throw new Exception(errorMessage);
- }
- }
- public static void EnsureNull(object value, string errorMessage)
- {
- if (value != null)
- {
- throw new Exception(errorMessage);
- }
- }
- }
- }
|