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.
精彩评论