/// <summary>
/// Converts the object passed in to its XML representation.
/// The XML string is written on the XmlTextWriter.
/// </summary>
public void ToXml(object value, FieldInfo field, XmlTextWriter xml, IMarshalContext context)
{
Type type = value.GetType();
if ( value is char[] )
{
char[] buffer = value as char[];
context.WriteStartTag( __arrayType, field, xml );
xml.WriteChars( buffer, 0, buffer.Length );
context.WriteEndTag( __arrayType, field, xml );
}
else
{
context.WriteStartTag( __type, field, xml );
xml.WriteString( value.ToString() );
context.WriteEndTag( __type, field, xml );
}
}