Table of Contents

Class DataContract

Namespace
ShapeShift.Schema
Assembly
ShapeShift.dll

Describes the serialized form of a .NET type in a format-neutral way.

public abstract class DataContract
Inheritance
DataContract
Derived
Inherited Members

Remarks

A contract describes the shape of the data as ShapeShift writes and reads it (maps, vectors, scalars and their relationships) without committing to any particular encoding. Format-specific projections such as JSON Schema are built on top of this model.

Contracts form an object graph that may contain cycles when the described types are recursive. For this reason contracts use reference equality and must not be compared structurally. Use ReferencedContracts to walk the graph, guarding against revisiting a node.

Contract instances are immutable and safe for concurrent use once they have been returned to a caller.

Properties

DataType

Gets the .NET type that this contract describes.

public Type DataType { get; }

Property Value

Type

Kind

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

public abstract DataContractKind Kind { get; }

Property Value

DataContractKind

ReferencedContracts

Gets the contracts that this contract directly refers to.

public virtual 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.

Methods

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.