Class HumlWriterContext
- Namespace
- Huml.Net.Serialization
- Assembly
- Huml.Net.dll
Provides the write-path context passed to Write(HumlWriterContext, T). Wraps the internal StringBuilder accumulator and serialiser options, exposing append methods without leaking internal types.
public sealed class HumlWriterContext
- Inheritance
-
HumlWriterContext
- Inherited Members
Properties
Depth
The current serialisation depth. Converters emitting indented block content can use this to compute indentation.
public int Depth { get; }
Property Value
Options
The serialisation options active for the current operation.
public HumlOptions Options { get; }
Property Value
Methods
AppendRaw(string)
Appends a raw HUML fragment verbatim. Use when the converter produces custom HUML syntax that cannot be expressed through AppendSerializedValue(object?).
public void AppendRaw(string huml)
Parameters
humlstringA raw HUML fragment appended verbatim. The caller is responsible for ensuring correctness. Any embedded newline will break the current mapping or sequence entry; a stray
::suffix will open an unmatched block. Only use this method when AppendSerializedValue(object?) is insufficient and the output is fully under the converter's control.
AppendSerializedValue(object?)
Appends the serialised representation of value using built-in
type dispatch. Use for nested values whose HUML encoding is handled by the library.
[RequiresUnreferencedCode("Reflection-based HUML serialisation.")]
public void AppendSerializedValue(object? value)
Parameters
valueobjectThe value to serialise.
Remarks
Do NOT call this method with a value of the same type the calling converter handles — doing so causes infinite recursion. Use AppendRaw(string) for the converter's own output type.