none
Performance: Datatable vs List/Dictionary ? RRS feed

  • Question

  • Hi,

    In my application, I have to retrieve a set of data from xml files and add it to the database while making sure that I dont add duplicates.

     

    If I'm gng to use Lists/Dictionary, I have to do the following:

    1) Search for the duplicates in the list/dictionary. If duplicate not found, then add it to the list

    2) After populating list/dictionary, I have to convert each row in it to datarow and add to datatable which wld be then inserted in to database.

     

    If I'm going to use DataTable from the start, I do not have to perform the step (2).

    I know for sure that searching is faster in Lists/Dictionary, but having each row in it converted to datarow any better than working with datatable itself from the start and avoid the step (2)? Which approach is better in terms of performance?

     

    Any suggestions?

     

    Thanks,

     


    - Shashi
    Thursday, October 20, 2011 5:10 PM

Answers

All replies