ListTool.cs 1020 B

1234567891011121314151617181920212223242526272829303132333435
  1. //############################################################
  2. // https://github.com/yuzhengyang
  3. // author:yuzhengyang
  4. //############################################################
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. namespace Y.Utils.DataUtils.Collections
  8. {
  9. public sealed class ListTool
  10. {
  11. public static bool IsNullOrEmpty(List<string> list)
  12. {
  13. if (list != null && list.Count() > 0)
  14. return false;
  15. return true;
  16. }
  17. public static bool IsNullOrEmpty<T>(List<T> list)
  18. {
  19. if (list != null && list.Count() > 0)
  20. return false;
  21. return true;
  22. }
  23. public static bool IsNullOrEmpty<T>(IEnumerable<T> list)
  24. {
  25. if (list != null && list.Count() > 0)
  26. return false;
  27. return true;
  28. }
  29. public static bool HasElements<T>(IEnumerable<T> list)
  30. {
  31. return !IsNullOrEmpty(list);
  32. }
  33. }
  34. }