Support for serializing to TextWriter