How to write in XML file in C#

Опубликовано: 26 Январь 2025
на канале: Programming Tutorials
223
7

XML is a platform independent language, so the information formatted in XML can be used in any other platforms (Operating Systems). Once we create an XML file in one platform it can be used in other platforms also.

In order to creating a new XML file in C#, we are using XmlTextWriter Class . The class takes FileName and Encoding as argument. Also we are here passing formatting details . The following C# source code creating an XML file product.xml and add four rows in the file.