开发者

How to use XML file as a data storage to Add, Retrieve, Update, Delete

开发者 https://www.devze.com 2023-02-01 13:58 出处:网络
I want to use XML file as a data source for my applica开发者_开发技巧tion. What approach should I take any example??

I want to use XML file as a data source for my applica开发者_开发技巧tion.

What approach should I take any example??

Thanx


This tutorial will show you how to use LINQ to XML to read and also add data to an external XML file, in C#, LINQ to XML C# Tutorial.

Another tutorial regarding LINQ to XML which explains LINQ a bit more can be found here

Also why are you opting for an XML file as data storage? Hope some of this will help though!

P.S. These tutorials are not mine thus credit goes out to the authors.


XML is very inefficient at the operations you mention. Manipulating XML files without reading the whole file into memory, changing it, and writing it back out again is very likely not worth the effort.

The better bet would be to use a real database, perhaps SQLite if you need something simple and file-based. Then you can write a simple routine to dump this data to XML whenever you require.

0

精彩评论

暂无评论...
验证码 换一张
取 消