XmlUtils - serialize/deserialize an object to/from Xml in VB.Net

Friday, June 27th, 2008

Here is an implementation using VB.Net of XmlUtils class from my old post. Yesterday, I wrote an implementation of XmlConverter using VB.Net. As I wrote the idea is to provide the code in VB.Net for people that use VB.Net as their favourite programming language. Both XmlConverter and XmlUtils do the same but the second one is [...]

Serialize/Deserialize a Font and Color to/from XML

Thursday, June 26th, 2008

Not so long ago I needed to store some of UI appearance values of my project into a custom XML file in order to allow the end-user to configure its UI appearance. As it is expected I had to store also fonts and colors. Both of them can not be directly serialized into XML. For serializing/deserializing colors [...]

XmlConverter - serialize/deserialize an object to/from Xml in VB.Net

Thursday, June 26th, 2008

Here is an implementation using VB.Net of XmlConverter class from my old post. I’ll not rewrite the post but just put the code and sample of its use. The idea is to allow some VB.Net guy to use the implementation as is and not to rewrite it from C# into VB.Net. BUT Let me underline that I’ve [...]

XmlConverter - serialize/deserialize an object to/from Xml (continue)

Tuesday, June 24th, 2008

Few days ago I wrote about a static class named XmlConverter. It contains few generic methods which allow an object to be serialized to XML or deserialized from XML. Today, I rewrite it to a XML utility class with extension methods. The following snippet contains the new class.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;
using System.Xml;

namespace XmlConverter.Utilities
{
 public static class XmlUtils
 {
  public static [...]

XmlConverter - serialize/deserialize an object to/from Xml

Friday, June 20th, 2008

Some time ago, I needed to serialize and deserialize different types of objects to/from XML. Because of that I decided to create a class with template methods to do this. The name of the class is XmlConverter (see below).
      public static class XmlConverter
{

public static string ToXml<T>(T value) where T : new()
{
return ToXml<T>(value, Encoding.UTF8);
}

public static [...]