Class ObjectContract
- Namespace
- ShapeShift.Schema
- Assembly
- ShapeShift.dll
Describes a type that is serialized as a map of named properties.
public sealed class ObjectContract : DataContract
- Inheritance
-
ObjectContract
- Inherited Members
Remarks
Properties that appear in a payload but are not described by Properties are silently ignored by the deserializer unless HasExtensionData is true, in which case they are preserved.
Constructors
ObjectContract(Type, IEnumerable<PropertyContract>)
Initializes a new instance of the ObjectContract class.
public ObjectContract(Type dataType, IEnumerable<PropertyContract> properties)
Parameters
dataTypeType- The .NET type that this contract describes.
propertiesIEnumerable<PropertyContract>The properties of the object.
Properties
Encoding
Gets a value indicating how this object's members are laid out in a payload.
public ObjectEncoding Encoding { get; init; }
Property Value
- ObjectEncoding
The default value is Map.
Remarks
When this is Positional, every entry in Properties carries a Position, and positions not claimed by any property are written as null placeholders.
HasExtensionData
Gets a value indicating whether unrecognized properties are captured in an extension data member.
public bool HasExtensionData { get; init; }
Property Value
Kind
Gets the kind of this contract, which identifies the concrete subclass.
public override DataContractKind Kind { get; }
Property Value
Properties
Gets the properties of the object, in the order they are written.
public ImmutableArray<PropertyContract> Properties { get; }
Property Value
ReferencedContracts
Gets the contracts that this contract directly refers to.
public override IEnumerable<DataContract> ReferencedContracts { get; }
Property Value
Remarks
The sequence may contain the same contract more than once, and (for recursive types) may transitively include this contract itself.