Table of Contents

Class DataContractSerializer

Namespace
MarymoorStudios.Core.Serialization
Assembly
MarymoorStudios.Core.Serialization.dll
public static class DataContractSerializer
Inheritance
DataContractSerializer
Inherited Members

Methods

GetTypeId<T>()

Returns the TypeId of T.

public static TypeId GetTypeId<T>()

Returns

TypeId

Type Parameters

T

The type whose TypeId should be computed.

Serialize<T>(T)

Writes the binary representation of an MCS DataContract type to Memory.

public static ReadOnlyMemory<byte> Serialize<T>(T data)

Parameters

data T

The value to serialize.

Returns

ReadOnlyMemory<byte>

The binary representation of the value.

Type Parameters

T

The type to serialize.

TryDeserialize<T>(ReadOnlyMemory<byte>, out T)

Parses the binary representation of an MCS DataContract type from a Memory.

public static bool TryDeserialize<T>(ReadOnlyMemory<byte> bytes, out T data)

Parameters

bytes ReadOnlyMemory<byte>

A memory buffer containing the value to parse.

data T

The deserialized value, if successful, default(T) otherwise.

Returns

bool

True if successful, false otherwise.

Type Parameters

T

The type to deserialize.