Table of Contents

Class DataSerializer

Namespace
Stride.Core.Serialization
Assembly
Stride.Core.dll

Describes how to serialize and deserialize an object without knowing its type. Used as a common base class for all data serializers.

public abstract class DataSerializer
Inheritance
DataSerializer
Derived

Fields

BinaryFormatVersion

public const int BinaryFormatVersion = 4000001

Field Value

int

SerializationTypeId

The type id of SerializationType. Used internally to avoid dealing with strings.

public ObjectId SerializationTypeId

Field Value

ObjectId

Properties

IsBlittable

public abstract bool IsBlittable { get; }

Property Value

bool

SerializationType

The type of the object that can be serialized or deserialized.

public abstract Type SerializationType { get; }

Property Value

Type

Methods

Initialize(SerializerSelector)

Initializes the specified serializer.

public virtual void Initialize(SerializerSelector serializerSelector)

Parameters

serializerSelector SerializerSelector

The serializer.

Remarks

This method should be thread-safe and OK to call multiple times.

PreSerialize(ref object, ArchiveMode, SerializationStream)

Performs the first step of serialization or deserialization.

public abstract void PreSerialize(ref object obj, ArchiveMode mode, SerializationStream stream)

Parameters

obj object

The object to process.

mode ArchiveMode

The serialization mode.

stream SerializationStream

The stream to serialize or deserialize to.

Remarks

Typically, it will instantiate the object if [null], and if it's a collection clear it.

Serialize(ref object, ArchiveMode, SerializationStream)

Serializes or deserializes the given object obj.

public abstract void Serialize(ref object obj, ArchiveMode mode, SerializationStream stream)

Parameters

obj object

The object to serialize or deserialize.

mode ArchiveMode

The serialization mode.

stream SerializationStream

The stream to serialize or deserialize to.