CollectionHelper.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace TEAMModelOS.SDK.Helper.Common.CollectionHelper
  6. {
  7. public static class CollectionHelper
  8. {
  9. /// <summary>
  10. /// 判断集合是否为空
  11. /// </summary>
  12. /// <param name="collection"></param>
  13. /// <returns></returns>
  14. public static bool IsEmpty(this ICollection collection)
  15. {
  16. if (collection != null && collection.Count > 0)
  17. {
  18. return false;
  19. }
  20. else {
  21. return true;
  22. }
  23. }
  24. /// <summary>
  25. /// 判断集合是否不为空
  26. /// </summary>
  27. /// <param name="collection"></param>
  28. /// <returns></returns>
  29. public static bool IsNotEmpty(this ICollection collection)
  30. {
  31. if (collection != null && collection.Count > 0)
  32. {
  33. return true;
  34. }
  35. else
  36. {
  37. return false;
  38. }
  39. }
  40. }
  41. }