title: Multiple threads filling up their result in one DataTable C#
body: <p>I'm just beginning to learn the concept of threading, and I'm kind of stuck at this one problem, its driving me crazy....</p>
  
  <p>What I actually need to accomplish -</p>
  
  <p>I have some 300 text files in a local directory, that need to be parsed for specific values... After I find these "values" in each text file, I need to store them in a database..
  So I followed the plain approach of accessing each text file in the directory - parsing and updating the resulting values as a row to a local DataTable, and when I'm done parsing all the files and storing 300 rows to the DataTable, I would do a SQLBulkCopy of DataTable to my database. This approach works fine except that it takes me about 10 minutes to run my code!</p>
  
  <p>What I'm attempting to do now -</p>
  
  <p>Create a new thread for each file and keep the thread count below 4 at any given time... then each thread would parse through the file and return a row to update the local DataTable</p>
  
  <p>Where I'm stuck - I don't understand how to update this single Datatable that gets rows from multiple threads...</p>
  
  <p>Quite an explanation isn't it.. hope some one here can suggest a good idea for this...</p>
  
  <p>Thanks,
  Nidhi</p>