Skip to content

ObjectSerializer Methods

Provides methods for serializing and deserializing values which have types which are not statically known.

CanSerialize(Type)

View source
public bool CanSerialize(Type type)
Returns true if the provided type, type, can be serialized, and false otherwise.

Parameters

typeType

Deserialize(ArraySegment<byte>, SerializerSession, Type)

View source
public object Deserialize(ArraySegment<byte> source, SerializerSession session, Type type)
Deserialize a value of type type from source.

Parameters

sourceArraySegment<byte>
The source buffer.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(ArraySegment<byte>, Type)

View source
public object Deserialize(ArraySegment<byte> source, Type type)
Deserialize a value of type type from source.

Parameters

sourceArraySegment<byte>
The source buffer.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(ReadOnlyMemory<byte>, SerializerSession, Type)

View source
public object Deserialize(ReadOnlyMemory<byte> source, SerializerSession session, Type type)
Deserialize a value of type type from source.

Parameters

sourceReadOnlyMemory<byte>
The source buffer.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(ReadOnlyMemory<byte>, Type)

View source
public object Deserialize(ReadOnlyMemory<byte> source, Type type)
Deserialize a value of type type from source.

Parameters

sourceReadOnlyMemory<byte>
The source buffer.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(ReadOnlySequence<byte>, SerializerSession, Type)

View source
public object Deserialize(ReadOnlySequence<byte> source, SerializerSession session, Type type)
Deserialize a value of type type from source.

Parameters

sourceReadOnlySequence<byte>
The source buffer.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(ReadOnlySequence<byte>, Type)

View source
public object Deserialize(ReadOnlySequence<byte> source, Type type)
Deserialize a value of type type from source.

Parameters

sourceReadOnlySequence<byte>
The source buffer.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(ReadOnlySpan<byte>, SerializerSession, Type)

View source
public object Deserialize(ReadOnlySpan<byte> source, SerializerSession session, Type type)
Deserialize a value of type type from source.

Parameters

sourceReadOnlySpan<byte>
The source buffer.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(ReadOnlySpan<byte>, Type)

View source
public object Deserialize(ReadOnlySpan<byte> source, Type type)
Deserialize a value of type type from source.

Parameters

sourceReadOnlySpan<byte>
The source buffer.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(Stream, SerializerSession, Type)

View source
public object Deserialize(Stream source, SerializerSession session, Type type)
Deserialize a value of type type from source.

Parameters

sourceStream
The source buffer.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(Stream, Type)

View source
public object Deserialize(Stream source, Type type)
Deserialize a value of type type from source.

Parameters

sourceStream
The source buffer.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(byte[], SerializerSession, Type)

View source
public object Deserialize(byte[] source, SerializerSession session, Type type)
Deserialize a value of type type from source.

Parameters

sourcebyte[]
The source buffer.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(byte[], Type)

View source
public object Deserialize(byte[] source, Type type)
Deserialize a value of type type from source.

Parameters

sourcebyte[]
The source buffer.
typeType
The expected type of the value.

Returns

The deserialized value.

Deserialize(Reader<TInput>, Type)

View source
public object Deserialize<TInput>(ref Reader<TInput> source, Type type)
Deserialize a value of type type from source.

Parameters

sourceReader<TInput>
The source buffer.
typeType
The expected type of the value.

Returns

The deserialized value.

Serialize(object, ArraySegment<byte>, SerializerSession, Type)

View source
public int Serialize(object value, ArraySegment<byte> destination, SerializerSession session, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationArraySegment<byte>
The destination where serialized data will be written.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Returns

The length of the serialized data.

Serialize(object, ArraySegment<byte>, Type)

View source
public int Serialize(object value, ArraySegment<byte> destination, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationArraySegment<byte>
The destination where serialized data will be written.
typeType
The expected type of the value.

Returns

The length of the serialized data.

Serialize(object, byte[], SerializerSession, Type)

View source
public int Serialize(object value, byte[] destination, SerializerSession session, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationbyte[]
The destination where serialized data will be written.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Returns

The length of the serialized data.

Serialize(object, byte[], Type)

View source
public int Serialize(object value, byte[] destination, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationbyte[]
The destination where serialized data will be written.
typeType
The expected type of the value.

Returns

The length of the serialized data.

Serialize(object, Stream, SerializerSession, Type, int)

View source
public void Serialize(object value, Stream destination, SerializerSession session, Type type, int sizeHint = 0)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationStream
The destination where serialized data will be written.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.
sizeHintint
The estimated upper bound for the length of the serialized data.

Serialize(object, Stream, Type, int)

View source
public void Serialize(object value, Stream destination, Type type, int sizeHint = 0)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationStream
The destination where serialized data will be written.
typeType
The expected type of the value.
sizeHintint
The estimated upper bound for the length of the serialized data.

Serialize(object, Memory<byte>, SerializerSession, Type)

View source
public void Serialize(object value, ref Memory<byte> destination, SerializerSession session, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationMemory<byte>
The destination where serialized data will be written.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Serialize(object, Memory<byte>, Type)

View source
public void Serialize(object value, ref Memory<byte> destination, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationMemory<byte>
The destination where serialized data will be written.
typeType
The expected type of the value.

Serialize(object, Span<byte>, SerializerSession, Type)

View source
public void Serialize(object value, ref Span<byte> destination, SerializerSession session, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationSpan<byte>
The destination where serialized data will be written.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Serialize(object, Span<byte>, Type)

View source
public void Serialize(object value, ref Span<byte> destination, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationSpan<byte>
The destination where serialized data will be written.
typeType
The expected type of the value.

Serialize(object, TBufferWriter, SerializerSession, Type)

View source
public void Serialize<TBufferWriter>(object value, TBufferWriter destination, SerializerSession session, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationTBufferWriter
The destination where serialized data will be written.
sessionSerializerSession
The serializer session.
typeType
The expected type of the value.

Serialize(object, TBufferWriter, Type)

View source
public void Serialize<TBufferWriter>(object value, TBufferWriter destination, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationTBufferWriter
The destination where serialized data will be written.
typeType
The expected type of the value.

Serialize(object, Writer<TBufferWriter>, Type)

View source
public void Serialize<TBufferWriter>(object value, ref Writer<TBufferWriter> destination, Type type)
Serializes the provided value into destination.

Parameters

valueobject
The value to serialize.
destinationWriter<TBufferWriter>
The destination where serialized data will be written.
typeType
The expected type of the value.