Best way to store data locally in .NET (C#)

后端 未结 19 1476
南方客
南方客 2020-11-28 01:53

I\'m writing an application that takes user data and stores it locally for use later. The application will be started and stopped fairly often, and I\'d like to make it save

19条回答
  •  伪装坚强ぢ
    2020-11-28 02:09

    Without knowing what your data looks like, i.e. the complexity, size, etc...XML is easy to maintain and easily accessible. I would NOT use an Access database, and flat files are more difficult to maintain over the long haul, particularly if you are dealing with more than one data field/element in your file.

    I deal with large flat-file data feeds in good quantities daily, and even though an extreme example, flat-file data is much more difficult to maintain than the XML data feeds I process.

    A simple example of loading XML data into a dataset using C#:

    DataSet reportData = new DataSet();
    
    reportData.ReadXml(fi.FullName);
    

    You can also check out LINQ to XML as an option for querying the XML data...

    HTH...

提交回复
热议问题