Table of Contents

Class OptionalContract

Namespace
ShapeShift.Schema
Assembly
ShapeShift.dll

Describes a type whose value may be absent, such as Nullable<T>.

public sealed class OptionalContract : DataContract
Inheritance
OptionalContract
Inherited Members

Remarks

An absent value is encoded as null.

Constructors

OptionalContract(Type, DataContract)

Initializes a new instance of the OptionalContract class.

public OptionalContract(Type dataType, DataContract elementType)

Parameters

dataType Type
The .NET type that this contract describes.
elementType DataContract

The contract describing the value when it is present.

Properties

ElementType

Gets the contract describing the value when it is present.

public DataContract ElementType { get; }

Property Value

DataContract

Kind

Gets the kind of this contract, which identifies the concrete subclass.

public override DataContractKind Kind { get; }

Property Value

DataContractKind

ReferencedContracts

Gets the contracts that this contract directly refers to.

public override IEnumerable<DataContract> ReferencedContracts { get; }

Property Value

IEnumerable<DataContract>

Remarks

The sequence may contain the same contract more than once, and (for recursive types) may transitively include this contract itself.