I just came across this question telling how to store ListView Data(basically ListView.Items) into a text file but it got me thinking that, is it the best way to do it? In terms of efficiency, basically running available operations of the data efficiently, because storing large ListView Data might take time to access when stored in .txt format and even storing them might take time. I thought maybe DataSet with DataTable might be a proper option. So what is the best option for storing a ListView Data into file?

  • Is there a reason you need files specifically and aren't storing and retrieving the ListView data in a database? as a vast generality, reading from a database is quicker than files. – Adam Wells Sep 26 '16 at 12:50
  • @AdamWells well I am new to Database that is why I don't know much about Database's properties and its correct usage(practically) therefore I asked what is the most efficient way to store, and retrieve data. If you say Database then my choice will be Relational Database, thanks for the help – AKC Sep 26 '16 at 12:58
  • @AdamWells sir, will Microsoft Access be able to do the job for me? Basically I just need to store ListView.Items and run some operations on it. I don't Server SQL systems. – AKC Sep 26 '16 at 13:06
  • Probably? I'm not an expert on Access. – Adam Wells Sep 26 '16 at 14:29

If its just a single user application, a file will do. Most applications store configuration in files as well so adding user data file(s) will be easy to do. Most data structures can be serialized into a file with just a few lines of code as long as the class is marked as serializable.

For structures that don't change all that much, one can read them from the file once and then maintain it in memory during the application lifetime. Changes can be saved as needed or persisted back to the file as needed, but runtime access is via the data stored in memory (cache) instead of reading and writing to the file each time. That will alleviate any performance concerns.

Databases are used in web or multi user applications because it's easier to get information from one source for many users as opposed to many files. Plus, a database table can be shared among many users. One cannot have multiple users editing the same file at the same time. Databases offer a level of concurrency not available with a file based approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.