Linq to .trim all values in datatable’s all rows & all columns?

With two Assign statements:

trimmedDataTable = originalDataTable.Clone
trimmedDataTable = originalDataTable.AsEnumerable.Select(Function(row) row.ItemArray.Select(Function(cell) cell.ToString().Trim()).ToArray()).Select(Function(cells) trimmedDataTable.Rows.Add(cells)).CopyToDataTable
2 Likes