ICrystalXmlSerializer<T>
Namespace: SnowBank.Data.Xml · interface
Serializes instances of T to XML, through any ICrystalXmlEmitter
Remarks
Implemented by the source-generated holder types (mirroring the JSON generator's per-type converters), and callable by hand for types that do not go through the generator. The where TEmitter : struct, ICrystalXmlEmitter constraint on WriteXml is what lets the same body target the byte-exact output writer or either infoset emitter without any virtual dispatch: the emitter type is only known at the call site, never boxed to the interface.
The eight public entry points in CrystalXml (ToText, ToSlice, and so on) are the only callers most code needs: each owns the whole sink lifecycle (construct the sink, construct the emitter over it, invoke WriteXml, read the result back), so nothing outside those helpers ever touches an emitter's writer directly.
Methods
WriteXml
void WriteXml<TEmitter>(ref TEmitter emitter, T value, CrystalXmlSettings? settings = null, string rootName = null)
Writes value to emitter
emitter— Destination emitter, passed byrefper the ICrystalXmlEmitter contractvalue— Value to write, ornullto write the empty/self-closing form of the root elementsettings— Optional settings controlling the output (for example, which lexical profile -DcsorGeneral- scalar members use)rootName— Optional override for the name of the root element written by this call, in place of the type's own default name
The depth counter of the generated cycle guard resets to zero across this call: see .