I fill a DataTable with search results, which take a very long time if
I first clear it. The values come from an object and I map them into
the corresponding table columns. I may have 65000 results. I iterate
through them, create a new row, fill it, and add it to the DataTable
for each interation. This works fine on the first search.
Before each search, I call DataTable.Clear() and do the above process.
Every search after the first one is extremely slow to fill the
DataTable. However, if I comment out the Clear() line, performance
doesn't suffer. Is there another way I can clean this table for each
search?
Why is .Clear() such a performance hit?
Thanks,
Brett