/// <summary> /// Checks argument value for not null /// </summary> /// <param name="arg1">The arg1 requirement</param> /// <param name="arg2">The arg2 requirement</param> public static void AnyNotNull(ArgumentRequirements <T> arg1, ArgumentRequirements <T> arg2) { if (arg1.value == null && arg2.value == null) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Argument '{0}' and '{1}' cannot be null at the same time", arg1.name, arg2.name), arg1.name); } }
/// <summary> /// Checks argument value not null or empty /// </summary> /// <param name="arg1">The arg1 requirement</param> /// <param name="arg2">The arg2 requirement</param> public static void AnyNotNullOrEmpty(ArgumentRequirements <T> arg1, ArgumentRequirements <T> arg2) { AnyNotNull(arg1, arg2); string stringValue1 = arg1.value as string; string stringValue2 = arg2.value as string; if (string.IsNullOrWhiteSpace(stringValue1) && string.IsNullOrWhiteSpace(stringValue2)) { throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Argument '{0}' and '{1}' cannot be empty at the same time", arg1.name, arg2.name), arg1.name); } }