简体   繁体   English

C#-避免每次都读取csv文件

[英]C# - Avoid reading csv file everytime

My input file have 7 million rows. 我的输入文件有700万行。 It is taking long time to read the file. 读取文件需要很长时间。 After that I have to modify the data based on clients requirement. 之后,我必须根据客户要求修改数据。 If client add a new requirement then I have to read the csv file again. 如果客户端添加新要求,那么我必须再次读取csv文件。 Is there any way to read and store csv file in some format in c#. 有什么办法可以在c#中以某种格式读取和存储csv文件。 So I can avoid reading csv file everytime. 因此,我可以避免每次都读取csv文件。 I cannot use SQL ,SQLITE or any other database to store the data. 我不能使用SQL,SQLITE或任何其他数据库来存储数据。

Your choices are: 您的选择是:

  1. Use another form of database - eg SQL, Mongo DB, Raven DB, Lucene 使用其他形式的数据库-例如SQL,Mongo DB,Raven DB,Lucene
  2. Store the file in memory, and only save the changes at a certain time 将文件存储在内存中,仅在特定时间保存更改
  3. Break the file into smaller files, eg ID's 0-100000, 100001-200000, etc 将文件分成较小的文件,例如ID的0-100000、100001-200000等
  4. Maintain another file of the 'changes' and recombine them as needed (this is probably a bad idea) 维护另一个“变更”文件,并根据需要重新组合(这可能是个坏主意)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM