Table of Contents

Method Serialize

Namespace
LMKit.Agents
Assembly
LM-Kit.NET.dll

Serialize()

Serializes the current AgentMemory instance into a binary format.

This method writes a header (including magic numbers and version information) followed by all stored data sources.

public byte[] Serialize()

Returns

byte[]

A byte array containing the binary representation of this instance.

Serialize(string)

Serializes the current instance into a binary format and writes it to the specified file.

If the file already exists, it will be overwritten.

public void Serialize(string path)

Parameters

path string

The file path where the serialized data will be written.

Exceptions

ArgumentNullException

Thrown if path is null or empty.

IOException

Thrown if an I/O error occurs during writing.

Serialize(Stream)

Serializes the current instance into a binary format and writes it to the provided stream.

The stream must be writable; otherwise, an ArgumentException is thrown.

public void Serialize(Stream stream)

Parameters

stream Stream

A writable stream to which the serialized data will be written.

Exceptions

ArgumentNullException

Thrown if stream is null.

ArgumentException

Thrown if stream is not writable.