平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LinqExtension.cs 537 B

4 months ago
123456789101112131415161718192021222324252627282930
  1. 
  2. //
  3. namespace SafeCampus.Core.Extension;
  4. /// <summary>
  5. /// Linq扩展
  6. /// </summary>
  7. [SuppressSniffer]
  8. public static class LinqExtension
  9. {
  10. /// <summary>
  11. /// 是否都包含
  12. /// </summary>
  13. /// <typeparam name="T"></typeparam>
  14. /// <param name="first">第一个列表</param>
  15. /// <param name="second">第二个列表</param>
  16. /// <returns></returns>
  17. public static bool ContainsAll<T>(this List<T> first, List<T>? second)
  18. {
  19. return second.All(s => first.Any(f => f.Equals(s)));
  20. }
  21. }