Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl.Echo/llms.txt
Use this file to discover all available pages before exploring further.
Serializer is the primary entry point for all serialization and deserialization in Prowl.Echo. It is a static class that converts .NET objects to and from EchoObject, the library’s intermediate representation. Internally, Serializer maintains a prioritized list of ISerializationFormat handlers — from fast-path primitive formatters through to a universal AnyObjectFormat fallback — and routes each type to the first handler that claims it.
Properties
The logger instance used by the serialization pipeline. Assign any implementation of
IEchoLogger to capture diagnostics. Defaults to NullEchoLogger, which discards all messages.Serialize
Four overloads cover every combination of explicit target type and explicitSerializationContext. When no SerializationContext is supplied, a new one is created internally with the given TypeMode.
Serialize(object?, TypeMode)
value using a freshly created SerializationContext. Because no declared target type is provided, the root object is always wrapped with type information in Auto mode so it can be round-tripped without the caller knowing the concrete type.
The object to serialize. Passing
null returns an EchoObject with TagType == EchoType.Null.Controls when type metadata is embedded. See the
TypeMode reference.EchoObject representing the serialized form of value.
Serialize(Type?, object?, TypeMode)
value treating targetType as the statically-declared type. Type metadata is only embedded when value’s runtime type differs from targetType (in Auto mode), enabling polymorphic fields to be round-tripped while keeping the output compact for non-polymorphic ones.
The declared/expected type at the call site. Pass
null to let the serializer infer it from the value’s runtime type.The object to serialize.
Controls when type metadata is embedded.
EchoObject representing the serialized form of value.
Serialize(object?, SerializationContext)
value using a caller-supplied SerializationContext. Reuse the same context across multiple calls when you need shared reference-tracking state (for example, when serializing an entire scene graph in one pass).
The object to serialize.
The serialization context. Its
OnSerialize hook is invoked before any built-in formatter runs, and its TypeMode governs type-metadata embedding.EchoObject representing the serialized form of value.
Serialize(Type?, object?, SerializationContext)
Serialize overloads ultimately call this one.
The declared/expected type at the call site.
The object to serialize.
The serialization context.
EchoObject representing the serialized form of value.
If
value is itself already an EchoObject, it is returned as-is without any further processing.Deserialize
AllDeserialize overloads mirror the Serialize overloads. When no SerializationContext is provided, a default one is created internally.
Deserialize<T>(EchoObject?)
value into type T using a default context.
The
EchoObject to deserialize. Returns the default value of T when null or EchoType.Null.T, or null/default if value is null or empty.
Deserialize(EchoObject?, Type)
The
EchoObject to deserialize.The type to deserialize into.
targetType, or null.
Deserialize<T>(EchoObject?, SerializationContext)
OnDeserialize hooks or was previously used during serialization and holds a populated reference table.
The
EchoObject to deserialize.The deserialization context. Its
OnDeserialize hook is invoked before any built-in formatter runs.T, or null/default.
Deserialize(EchoObject?, Type, SerializationContext)
Deserialize overloads call this one.
The
EchoObject to deserialize.The target type.
The deserialization context.
targetType, or null.
If the
EchoObject contains embedded type metadata (a $type key), the serializer resolves the actual type from that metadata and uses it instead of targetType. This enables transparent polymorphic deserialization.DeserializeInto
DeserializeInto writes deserialized field values into an existing object instance instead of constructing a new one. This is valuable when the target object holds non-serialized state — GPU resources, history buffers, caches — that should not be discarded during a hot-reload or network update.
DeserializeInto(EchoObject?, object)
The serialized data to read from. No-op when
null or EchoType.Null.The existing object whose fields will be overwritten. Must not be
null.DeserializeInto(EchoObject?, object, SerializationContext)
The serialized data to read from.
The existing object whose fields will be overwritten.
The deserialization context, including any
OnDeserialize hooks.Format Management
RegisterFormat(ISerializationFormat)
AnyObjectFormat fallback which remains last.
Calling RegisterFormat automatically clears the internal format cache so the new handler is consulted on the next serialization operation for each type.
The custom format to register. Its
CanHandle(Type) method determines which types it intercepts.ClearCache()
ReflectionUtils, and the type-name lookup cache in TypeNameRegistry. Call this after dynamically loading or unloading assemblies to ensure the serializer picks up new or removed types.