using System; namespace Wayne.Lib { public static class ParamGuard { public static void AssertIsNotNull(T paramValue, string paramName) where T : class { if (paramValue == null) { throw new ArgumentNullException(paramName); } } public static void AssertMeetsCondition(T paramValue, Func paramChecker, string paramName, string conditionName) { if (!paramChecker(paramValue)) { throw new ArgumentException(string.Format("Parameter {0} does not meet condition {1} ", paramName, conditionName)); } } public static void AssertNotNullOrEmpty(string paramValue, string paramName) { if (string.IsNullOrEmpty(paramValue)) { throw new ArgumentException(string.Format("Parameter {0} is null or empty ", paramName)); } } } }