DataTableCollectionExtension.cs 741 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. namespace Bowin.Common.Utility
  7. {
  8. public static class DataTableCollectionExtension
  9. {
  10. /// <summary>
  11. /// 移除所有空行。
  12. /// </summary>
  13. /// <param name="ds"></param>
  14. /// <returns></returns>
  15. public static void RemoveAllEmpty(this DataTableCollection dataTableCollection)
  16. {
  17. if (dataTableCollection == null)
  18. {
  19. throw new ArgumentNullException("dataTableCollection");
  20. }
  21. foreach (DataTable dt in dataTableCollection)
  22. {
  23. dt.Rows.RemoveAllEmpty();
  24. }
  25. }
  26. }
  27. }