public void Serialize(object data, IPropertyVisitor visitor, ObjectSerializerSettings settings = null) { Visitor = visitor; Settings = settings ?? new ObjectSerializerSettings(); if (data != null && data.GetType() != DataType) throw new ArgumentException(string.Format("Cannot serialize {0} - expected {1}.", data.GetType(), DataType), "data"); visitor.Begin(); Serialize(data, DataType, ""); visitor.End(); }
public void Serialize(object data, IPropertyVisitor visitor, ObjectSerializerSettings settings = null) { Visitor = visitor; Settings = settings ?? new ObjectSerializerSettings(); if (data != null && data.GetType() != DataType) { throw new ArgumentException(string.Format("Cannot serialize {0} - expected {1}.", data.GetType(), DataType), "data"); } visitor.Begin(); Serialize(data, DataType, ""); visitor.End(); }