Table of Contents

Class BinaryConverter

Namespace
ShapeShift.Cbor
Assembly
ShapeShift.Cbor.dll

Converts byte arrays using the CBOR byte string family.

public sealed class BinaryConverter : ShapeShiftConverter<byte[], CborEncoder, CborDecoder>
Inheritance
BinaryConverter
Inherited Members

Methods

GetContract(ContractContext<CborEncoder, CborDecoder>)

Describes the serialized form that this converter produces and accepts.

public override DataContract? GetContract(ContractContext<CborEncoder, CborDecoder> context)

Parameters

context ContractContext<CborEncoder, CborDecoder>

Services for describing other types that this converter composes with.

Returns

DataContract

The contract for the data this converter reads and writes, or null if this converter does not describe itself.

Remarks

The default implementation returns null, which causes ShapeShift to describe the type with an UndocumentedContract rather than guess at a representation. Override this method so that schema consumers can understand your converter's output.

The returned contract must describe exactly what WriteObject(ref TEncoder, object?, SerializationContext<TEncoder, TDecoder>) emits.

Read(ref CborDecoder, SerializationContext<CborEncoder, CborDecoder>)

public override byte[]? Read(ref CborDecoder decoder, SerializationContext<CborEncoder, CborDecoder> context)

Parameters

decoder CborDecoder
context SerializationContext<CborEncoder, CborDecoder>

Returns

byte[]

Write(ref CborEncoder, in byte[]?, SerializationContext<CborEncoder, CborDecoder>)

public override void Write(ref CborEncoder encoder, in byte[]? value, SerializationContext<CborEncoder, CborDecoder> context)

Parameters

encoder CborEncoder
value byte[]
context SerializationContext<CborEncoder, CborDecoder>