Drawing3d documented Class Library

NicerXMLFormatter Properties

The properties of the NicerXMLFormatter class are listed below. For a complete list of NicerXMLFormatter class members, see the NicerXMLFormatter Members topic.

Public Instance Properties

Binder Gets or sets the type binder.
Context Gets or sets the StreamingContext.
StringConverter With the StringConverter you can convert objects to a string. If you do this, the object has the behavior of a primitiv object. The avantage is also, that the XML is better to read. For example: if you have a object Point with the fields X and Y ( of type int) you get the XML source like
 <field type:Point > <X>3</X> <Y>5</Y> </field> 
You can make your own Stringconverter like this:
 public class MyStringConverter:CustomStringConverter { public override bool CanConvert(Type Type) { if (base.Convert(Type)) return true; if (Type == typeof(Point)) return true; if (Type == typeof(Color)) return true; return false; } public override string ConvertToString(object Value, Type Type) { if (base.Convert(Type)) return base.ConvertToString(value,Type); if (Type == typeof(Point)) return (Point.X.ToString)+","+(Point.y.ToString); if (Type == typeof(Color)) return new ColorConverter().ConvertToString(Value); return ""; } public override object ConvertFromString(String Value, Type Type) { if (base.CanConvert(Type)) return base.ConvertFromString(Value,Type); if (Type == typeof(Point)) { string[] S = Value.Split(','); return new Point(Convert.ToInt32(S[0]), Convert.ToInt32(S[1])); } if (Type == typeof(Color)) return new ColorConverter().ConvertFromString(Value); return false; } } 
You have to set this in the StringConverter property: StringConverter = new MyStringConverter;
SurrogateSelector Gets or sets the SurrogateSelector.

See Also

NicerXMLFormatter Class | Drawing3d Namespace