1. Deserializing Objects from XML in C#

    Here's another C# code snippet that takes me way too much time to recreate by just reading the documentation.

    This is a simple example of a class that can be serialized to/from XML. In this case the "ServerConfig" XML string can contain a list of servers, looking like this …

    » Read more

  2. Pretty-formatting XML in C#

    I had a need to convert an XML string to a nice, indented format. It was a little more complicated than I expected, so I'm posting this snippet here where I can find it again when I need it.

    using System;
    using System.Text;
    using System.Xml;
    using System.Xml …

    » Read more

© 2003-2023 Kristopher Johnson