ListTool.cs 816 B

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