Table of Contents

Class ContractContext<TEncoder, TDecoder>

Namespace
ShapeShift.Schema
Assembly
ShapeShift.dll

Provides the services a converter needs in order to describe its serialized form.

public sealed class ContractContext<TEncoder, TDecoder> where TEncoder : IEncoder, allows ref struct where TDecoder : IDecoder, allows ref struct

Type Parameters

TEncoder

The type of encoder to use.

TDecoder

The type of decoder to use.

Inheritance
ContractContext<TEncoder, TDecoder>
Inherited Members

Remarks

An instance of this type is handed to GetContract(ContractContext<TEncoder, TDecoder>).

Properties

TypeShape

Gets the shape of the type being described, when one is available.

public ITypeShape? TypeShape { get; }

Property Value

ITypeShape

Methods

GetContract(ITypeShape)

Describes another type, so that a converter can compose its own contract from the contracts of its parts.

public DataContract GetContract(ITypeShape typeShape)

Parameters

typeShape ITypeShape

The shape of the type to describe.

Returns

DataContract

The contract for typeShape.

Remarks

The returned contract may still be under construction when the described type participates in a reference cycle with the type being described. Store the reference, but do not inspect its members until after GetContract(ContractContext<TEncoder, TDecoder>) returns.