DataSerializer Class
Namespace: Stride.Core.SerializationAssembly: 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
| Name | Description | |
|---|---|---|
| Fields | ||
| BinaryFormatVersion | ||
| SerializationTypeId | The type id of SerializationType. Used internally to avoid dealing with strings. |
|
| Properties | ||
| IsBlittable | ||
| SerializationType | The type of the object that can be serialized or deserialized. |
|
| Methods | ||
| Initialize(SerializerSelector) | Initializes the specified serializer. |
|
| PreSerialize(ref Object, ArchiveMode, SerializationStream) | Performs the first step of serialization or deserialization. |
|
| Serialize(ref Object, ArchiveMode, SerializationStream) | Serializes or deserializes the given object |
|
Fields
BinaryFormatVersion
public const int BinaryFormatVersion = 4000001
Field Value
| Type | Description |
|---|---|
| System.Int32 |
SerializationTypeId
The type id of SerializationType. Used internally to avoid dealing with strings.
public ObjectId SerializationTypeId
Field Value
| Type | Description |
|---|---|
| ObjectId |
Properties
IsBlittable
public abstract bool IsBlittable { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
SerializationType
The type of the object that can be serialized or deserialized.
public abstract Type SerializationType { get; }
Property Value
| Type | Description |
|---|---|
| System.Type |
Methods
Initialize(SerializerSelector)
Initializes the specified serializer.
public virtual void Initialize(SerializerSelector serializerSelector)
Parameters
| Type | Name | Description |
|---|---|---|
| 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
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object to process. |
| ArchiveMode | mode | The serialization mode. |
| SerializationStream | stream | 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
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object to serialize or deserialize. |
| ArchiveMode | mode | The serialization mode. |
| SerializationStream | stream | The stream to serialize or deserialize to. |