Write/Edit CSV-file (not rewrite the whole file!)

前端 未结 3 1594
挽巷
挽巷 2021-01-27 10:15

I\'m in a situation to replace some functionalities from a client that operates directly on a CSV file, which used as a config file for a system.

Most of the cases avai

3条回答
  •  灰色年华
    2021-01-27 10:45

    The .NET Framework v4.0 comes with a new class for memorymapped file support, see

    1. msdn
    2. article

    You will have a good chance of making this work for you. You will still be stuck with the problem to solve when linelenghts change. However, if you want random access and spurious updates (replacing "MSFT" by "UNIX", e.g.) you'll get awesome unrivalled performance.

    You could employ padding strategies to have 'spare room' in each cell/line to overcome the problems with changing field/line lengths.

    In general, I don't think it is worth the cost for CSV files, but the technique comes up every now and then and is worth mentioning.

    Cheers, Seth

提交回复
热议问题