Table of Contents

Class CborSerializer

Namespace
ShapeShift.Cbor
Assembly
ShapeShift.Cbor.dll

Serializes PolyType-described object graphs as CBOR.

public sealed record CborSerializer : ShapeShiftSerializer<CborEncoder, CborDecoder>, IEquatable<ShapeShiftSerializer<CborEncoder, CborDecoder>>, IEquatable<CborSerializer>
Inheritance
CborSerializer
Implements
Inherited Members

Constructors

CborSerializer()

Initializes a new instance of the CborSerializer class.

public CborSerializer()

Methods

Deserialize<T>(ReadOnlyMemory<byte>)

Deserializes a value from CBOR.

public T? Deserialize<T>(ReadOnlyMemory<byte> cbor) where T : IShapeable<T>

Parameters

cbor ReadOnlyMemory<byte>

The CBOR document.

Returns

T

The decoded value.

Type Parameters

T

The value type.

Deserialize<T, TProvider>(ReadOnlyMemory<byte>)

Deserializes a value from CBOR using a specified shape provider.

public T? Deserialize<T, TProvider>(ReadOnlyMemory<byte> cbor) where TProvider : IShapeable<T>

Parameters

cbor ReadOnlyMemory<byte>

The CBOR document.

Returns

T

The decoded value.

Type Parameters

T

The value type.

TProvider

The type shape provider.

Serialize<T>(in T?)

Serializes a value as CBOR.

public byte[] Serialize<T>(in T? value) where T : IShapeable<T>

Parameters

value T

The value to serialize.

Returns

byte[]

The CBOR document.

Type Parameters

T

The value type.

Serialize<T, TProvider>(in T?)

Serializes a value as CBOR using a specified shape provider.

public byte[] Serialize<T, TProvider>(in T? value) where TProvider : IShapeable<T>

Parameters

value T

The value to serialize.

Returns

byte[]

The CBOR document.

Type Parameters

T

The value type.

TProvider

The type shape provider.