Table of Contents

Class EnumContract

Namespace
ShapeShift.Schema
Assembly
ShapeShift.dll

Describes an enum type.

public sealed class EnumContract : DataContract
Inheritance
EnumContract
Inherited Members

Remarks

Deserialization always accepts either the name of a member (case-insensitively) or its underlying numeric value, regardless of IsSerializedByName.

Constructors

EnumContract(Type, DataContract, IEnumerable<EnumMemberContract>)

Describes an enum type.

public EnumContract(Type dataType, DataContract underlyingType, IEnumerable<EnumMemberContract> members)

Parameters

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

The contract for the enum's underlying integral type.

members IEnumerable<EnumMemberContract>

The declared members of the enum.

Remarks

Deserialization always accepts either the name of a member (case-insensitively) or its underlying numeric value, regardless of IsSerializedByName.

Properties

IsFlags

Gets a value indicating whether the enum is decorated with FlagsAttribute.

public bool IsFlags { get; init; }

Property Value

bool

IsSerializedByName

Gets a value indicating whether values are written using their member name when a name is available.

public bool IsSerializedByName { get; init; }

Property Value

bool

The default value is true.

Remarks

When false, or when the value has no matching declared member (as is common for flags enums), the underlying numeric value is written instead.

Kind

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

public override DataContractKind Kind { get; }

Property Value

DataContractKind

Members

Gets the declared members of the enum.

public ImmutableArray<EnumMemberContract> Members { get; }

Property Value

ImmutableArray<EnumMemberContract>

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.

UnderlyingType

Gets the contract for the enum's underlying integral type.

public DataContract UnderlyingType { get; }

Property Value

DataContract