11
Answers

C#: Iterating through a huge datatable

Nishanthan Ganeshan

Nishanthan Ganeshan

9y
4.9k
1
I have 2 data-tables which i need to compare and get the result in different table.Almost i am comparing 1000 records and it takes 2 minutes for doing comparison and get the result.I am using for loop.

Is there any other way i can optimize the for loop and reduce the processing time.

Ex : for (int i = 0; i < dt1.Rows.Count; i++)
      {
         for (int j = 0; j < _dt2.Count; j++)
        {
           //Process
        }

      }


Answers (11)