<p>Is there a clever way of adding XML serialization instructions without modifying the serialized class?</p>

<p>I don’t like the default serialization and I can’t modify the class. I was considering inheriting the class, and using Shadows (VB.NET) to re-implement the properties (with the serialization instructions), but it results in a lot of duplicate code and just looks terrible.</p>

<p>The ideal solution I'm looking for is basically a method to keep all the serialization instructions in a separate file.</p>

Use reflection to get the values of all the properties from the class then write them as attributes on to an XmlNode
```
```
PropertyInfo[] properties = control.GetType().GetProperties();
foreach (PropertyInfo property in properties)
{
  object o = property.GetValue(control, null);
  // write value of o.ToString() out as an attribute on a XmlNode
  // where attribute name is property.Name
}
```
```