Table of Contents

Class ShapeShiftConverter<TEncoder, TDecoder>

Namespace
ShapeShift
Assembly
ShapeShift.dll
public abstract class ShapeShiftConverter<TEncoder, TDecoder> where TEncoder : IEncoder, allows ref struct where TDecoder : IDecoder, allows ref struct

Type Parameters

TEncoder
TDecoder
Inheritance
ShapeShiftConverter<TEncoder, TDecoder>
Derived
Inherited Members

Methods

GetContract(ContractContext<TEncoder, TDecoder>)

Describes the serialized form that this converter produces and accepts.

public virtual DataContract? GetContract(ContractContext<TEncoder, TDecoder> context)

Parameters

context ContractContext<TEncoder, TDecoder>

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.

ReadObject(ref TDecoder, SerializationContext<TEncoder, TDecoder>)

public abstract object? ReadObject(ref TDecoder decoder, SerializationContext<TEncoder, TDecoder> context)

Parameters

decoder TDecoder
context SerializationContext<TEncoder, TDecoder>

Returns

object

WriteObject(ref TEncoder, object?, SerializationContext<TEncoder, TDecoder>)

public abstract void WriteObject(ref TEncoder encoder, object? value, SerializationContext<TEncoder, TDecoder> context)

Parameters

encoder TEncoder
value object
context SerializationContext<TEncoder, TDecoder>