Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    DataSerializer Class

    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.

    System.Object → DataSerializer
    Derived from DataSerializer: DataSerializer<T>

    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 obj.

    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation