DEV Community

Joe Enos
Joe Enos

Posted on

XmlWriter in .NET

.NET gives you the XmlWriter class, which lets you build XML exactly how you want it. XML serialization requires a lot of upfront configuration, and often trial-and-error, before you figure out exactly which attributes you need and how to serialize your data perfectly. With XmlWriter, you get more control over the steps.

It's tedious, and can result in errors if you're not careful, but you can make it work.

Here's a video showing an example of how to build custom XML, along with the source code:

Here's the code for the sample on GitHub

Discussion (0)