/// <summary> /// Ensures that the collection contains at most the number of specified items /// </summary> /// <param name="collection"> /// The collection to be validated. /// </param> /// <param name="minNumberOfItems"> /// The maximum number of items that the collection must have /// </param> /// <param name="argumentName"> /// The argument name. /// </param> /// <exception cref="System.ArgumentNullException"> /// If the collection itself is null /// </exception> /// <exception cref="System.ArgumentException"> /// If the collection contains more than the minumum number of items. OR. the maxNumberOfItems /// argument is less than zero. /// </exception> public static void ContainsAtMost <T>(IEnumerable <T> collection, int maxNumberOfItems, string argumentName) { Insist.ContainsAtMost(collection, maxNumberOfItems, argumentName, null); }