BinarySerializer Class

Provides public static methods for binary serialization. Most of its methods use a BinarySerializationFormatter instance internally.
See the Remarks section of the BinarySerializationFormatter class for details and examples.

Definition

Namespace: KGySoft.Serialization.Binary
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0-preview.1
C#
public static class BinarySerializer
Inheritance
Object    BinarySerializer

Methods

CreateFormatter Creates a formatter that can be used for serialization and deserialization with given options.
Deserialize(Byte, Int32, BinarySerializationOptions) Deserializes the specified part of a byte array into an object. If SafeMode is enabled in options and rawData contains natively not supported types by name, then you should use the other overloads to specify the expected types.
See the Remarks section of the DeserializeT(Byte, Int32, BinarySerializationOptions, Type) overload for details.
Deserialize(Byte, Int32, IEnumerableType) Deserializes the specified part of a byte array into an object using safe mode.
See the Remarks section of the DeserializeT(Byte, Int32, BinarySerializationOptions, Type) overload for details.
Deserialize(Byte, Int32, Type) Deserializes the specified part of a byte array into an object using safe mode.
See the Remarks section of the DeserializeT(Byte, Int32, BinarySerializationOptions, Type) overload for details.
Deserialize(Byte, Int32, BinarySerializationOptions, IEnumerableType) Deserializes the specified part of a byte array into an object.
See the Remarks section of the DeserializeT(Byte, Int32, BinarySerializationOptions, Type) overload for details.
Deserialize(Byte, Int32, BinarySerializationOptions, Type) Deserializes the specified part of a byte array into an object.
See the Remarks section of the DeserializeT(Byte, Int32, BinarySerializationOptions, Type) overload for details.
DeserializeT(Byte, Int32, IEnumerableType) Deserializes the specified part of a byte array into an instance of T using safe mode.
See the Remarks section of the DeserializeT(Byte, Int32, BinarySerializationOptions, Type) overload for details.
DeserializeT(Byte, Int32, Type) Deserializes the specified part of a byte array into an instance of T using safe mode.
See the Remarks section of the DeserializeT(Byte, Int32, BinarySerializationOptions, Type) overload for details.
DeserializeT(Byte, Int32, BinarySerializationOptions, IEnumerableType) Deserializes the specified part of a byte array into an instance of T.
See the Remarks section of the DeserializeT(Byte, Int32, BinarySerializationOptions, Type) overload for details.
DeserializeT(Byte, Int32, BinarySerializationOptions, Type) Deserializes the specified part of a byte array into an instance of T.
DeserializeByReader(BinaryReader, BinarySerializationOptions) Deserializes the content of a serialization stream wrapped by the specified reader from its current position into an object. If SafeMode is enabled in options and the stream contains natively not supported types by name, then you should use the other overloads to specify the expected types.
See the Remarks section of the DeserializeByReaderT(BinaryReader, BinarySerializationOptions, Type) overload for details.
DeserializeByReader(BinaryReader, IEnumerableType) Deserializes the content of a serialization stream wrapped by the specified reader from its current position into an object using safe mode.
See the Remarks section of the DeserializeByReaderT(BinaryReader, BinarySerializationOptions, Type) overload for details.
DeserializeByReader(BinaryReader, Type) Deserializes the content of a serialization stream wrapped by the specified reader from its current position into an object using safe mode.
See the Remarks section of the DeserializeByReaderT(BinaryReader, BinarySerializationOptions, Type) overload for details.
DeserializeByReader(BinaryReader, BinarySerializationOptions, IEnumerableType) Deserializes the content of a serialization stream wrapped by the specified reader from its current position into an object.
See the Remarks section of the DeserializeByReaderT(BinaryReader, BinarySerializationOptions, Type) overload for details.
DeserializeByReader(BinaryReader, BinarySerializationOptions, Type) Deserializes the content of a serialization stream wrapped by the specified reader from its current position into an object.
See the Remarks section of the DeserializeByReaderT(BinaryReader, BinarySerializationOptions, Type) overload for details.
DeserializeByReaderT(BinaryReader, IEnumerableType) Deserializes the content of a serialization stream wrapped by the specified reader from its current position into an instance of T using safe mode.
See the Remarks section of the DeserializeByReaderT(BinaryReader, BinarySerializationOptions, Type) overload for details.
DeserializeByReaderT(BinaryReader, Type) Deserializes the content of a serialization stream wrapped by the specified reader from its current position into an instance of T using safe mode.
See the Remarks section of the DeserializeByReaderT(BinaryReader, BinarySerializationOptions, Type) overload for details.
DeserializeByReaderT(BinaryReader, BinarySerializationOptions, IEnumerableType) Deserializes the content of a serialization stream wrapped by the specified reader from its current position into an instance of T.
See the Remarks section of the DeserializeByReaderT(BinaryReader, BinarySerializationOptions, Type) overload for details.
DeserializeByReaderT(BinaryReader, BinarySerializationOptions, Type) Deserializes the content of a serialization stream wrapped by the specified reader from its current position into an instance of T.
DeserializeFromStream(Stream, BinarySerializationOptions) Deserializes the content of the specified serialization stream from its current position into an object. If SafeMode is enabled in options and stream contains natively not supported types by name, then you should use the other overloads to specify the expected types.
See the Remarks section of the DeserializeFromStreamT(Stream, BinarySerializationOptions, Type) overload for details.
DeserializeFromStream(Stream, IEnumerableType) Deserializes the content of the specified serialization stream from its current position into an object using safe mode.
See the Remarks section of the DeserializeFromStreamT(Stream, BinarySerializationOptions, Type) overload for details.
DeserializeFromStream(Stream, Type) Deserializes the content of the specified serialization stream from its current position into an object using safe mode.
See the Remarks section of the DeserializeFromStreamT(Stream, BinarySerializationOptions, Type) overload for details.
DeserializeFromStream(Stream, BinarySerializationOptions, IEnumerableType) Deserializes the content of the specified serialization stream from its current position into an object.
See the Remarks section of the DeserializeFromStreamT(Stream, BinarySerializationOptions, Type) overload for details.
DeserializeFromStream(Stream, BinarySerializationOptions, Type) Deserializes the content of the specified serialization stream from its current position into an object.
See the Remarks section of the DeserializeFromStreamT(Stream, BinarySerializationOptions, Type) overload for details.
DeserializeFromStreamT(Stream, IEnumerableType) Deserializes the content of the specified serialization stream from its current position into an instance of T using safe mode.
See the Remarks section of the DeserializeFromStreamT(Stream, BinarySerializationOptions, Type) overload for details.
DeserializeFromStreamT(Stream, Type) Deserializes the content of the specified serialization stream from its current position into an instance of T using safe mode.
See the Remarks section of the DeserializeFromStreamT(Stream, BinarySerializationOptions, Type) overload for details.
DeserializeFromStreamT(Stream, BinarySerializationOptions, IEnumerableType) Deserializes the content of the specified serialization stream from its current position into an instance of T.
See the Remarks section of the DeserializeFromStreamT(Stream, BinarySerializationOptions, Type) overload for details.
DeserializeFromStreamT(Stream, BinarySerializationOptions, Type) Deserializes the content of the specified serialization stream from its current position into an instance of T.
DeserializeValueArrayT Deserializes an array of ValueType objects from a byte array that was previously serialized by SerializeValueArray method.
DeserializeValueType(Type, Byte) Deserializes a ValueType object from a byte array that was previously serialized by SerializeValueType method.
DeserializeValueType(Type, Byte, Int32) Deserializes a ValueType object from a byte array that was previously serialized by SerializeValueType method beginning on a specified offset.
DeserializeValueTypeT(Byte) Deserializes an instance of T from a byte array that was previously serialized by the SerializeValueTypeT(T) method.
DeserializeValueTypeT(Byte, Int32) Deserializes an instance of T from a byte array that was previously serialized by the SerializeValueTypeT(T) method.
ExtractExpectedTypes(Type, Boolean) Extracts a flattened collection of expected types from type for deserialization. Can be useful for deserialization methods in safe mode when type is a custom type directly referencing other custom types using default serialization.
See the Remarks section of the ExtractExpectedTypesT(Boolean) overload for details.
ExtractExpectedTypesT(Boolean) Extracts a flattened collection of expected types from T for deserialization. Can be useful for deserialization methods in safe mode when T is a custom type directly referencing other custom types using default serialization.
Serialize Serializes an object into a byte array.
SerializeByWriter Serializes the given data by using the provided writer.
SerializeToStream Serializes the given data into a stream.
SerializeValueArrayT Serializes an Array of ValueType elements into a byte array.
SerializeValueType(ValueType) Serializes a ValueType into a byte array. If the type of the specified instance contains any references, then it is tried to be serialized by marshaling as a fallback option.
SerializeValueTypeT(T) Serializes the specified value into a byte array.
TrySerializeValueArrayT Tries to serialize an Array of ValueType elements into a byte array.
See the Remarks section of the SerializeValueArrayT(T) method for details.
TrySerializeValueType(ValueType, Byte) Tries to serialize a ValueType into a byte array. The operation will succeed if the type of the specified instance does not contain any references.
See also the Remarks section of the SerializeValueType(ValueType) method for details.
TrySerializeValueTypeT(T, Byte) Tries to serialize the specified value into a byte array. The operation will succeed if T does not contain any references.
See the Remarks section of the SerializeValueTypeT(T) method for details.

See Also