/// <summary> /// 检查集合至少包含多少个元素 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="argument"></param> /// <param name="argumentName"></param> /// <param name="number"></param> /// <param name="message"></param> public static void IsAtLeast <T>(ICollection <T> argument, string argumentName, int number, string message = null) { AssertionJudgment.Require2Validation <ArgumentOutOfRangeException>( CollectionJudgment.ContainsAtLeast(argument, number), argumentName, argument.Count, message ?? $"{nameof(argument)} should has {number} items at least."); }
/// <summary> /// 检查一个集合是否拥有指定数量的成员 /// </summary> /// <typeparam name="T">动态类型</typeparam> /// <param name="enumeration"></param> /// <param name="count"></param> /// <returns></returns> public static bool ContainsAtLeast <T>(this ICollection <T> enumeration, int count) => CollectionJudgment.ContainsAtLeast(enumeration, count);