简体   繁体   中英

Easily read and write XML using C#

I have already found something for reading XML, however I find it difficult to write and update XML.

Can anybody please help in giving some code or advice on the best way of writing to XML files?

Use LINQ to XML .

Based on the fact you're using .NET 3.5 , LINQ to XML makes life so much easier when working with XML. Reading, writing, and amending XML documents via LINQ is a breeze. The link I posted is just a quick overview, but it should at least give you a taste of what it's like.

Load it up in an XmlDocument first. Also see the link for more information and examples.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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