public static void AssertNotNullOrEmpty(string arg, string argName, bool trim) { if (string.IsNullOrEmpty(arg) || trim && ArgumentHelper.IsOnlyWhitespace(arg)) { throw new ArgumentException("Cannot be null or empty.", argName); } }