Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# resuable library to treat a text file like a database table?

Tags:

c#

text-files

I would like to store values in a text file as comma or tab seperated values (it doesn't matter).

I am looking for a reusable library that can manipulate this data in this text file, as if it were a sql table.

I need select * from... and delete from where ID = ...... (ID will be the first column in the text file).

Is there some code plex project that does this kind of thing?

I do not need complex functionality like joining or relationships. I will just have 1 text file, which will become 1 database table.

like image 249
JL. Avatar asked Dec 07 '25 10:12

JL.


2 Answers

SQLite

:)

like image 141
Drevak Avatar answered Dec 10 '25 06:12

Drevak


Use LINQ to CSV.

http://www.codeproject.com/KB/linq/LINQtoCSV.aspx

http://www.thinqlinq.com/Post.aspx/Title/LINQ-to-CSV-using-DynamicObject.aspx

If its not CSV in that case

Let your file hold one record per line. Each record at runtime should be read into a Collection of type Record [assuming Record is custom class representing individual record]. You can do LINQ operations on the collection and write back the collection into file.

like image 44
this. __curious_geek Avatar answered Dec 10 '25 04:12

this. __curious_geek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!