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
dataTypeType- The .NET type that this contract describes.
underlyingTypeDataContractThe contract for the enum's underlying integral type.
membersIEnumerable<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
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
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
Members
Gets the declared members of the enum.
public ImmutableArray<EnumMemberContract> Members { 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.
UnderlyingType
Gets the contract for the enum's underlying integral type.
public DataContract UnderlyingType { get; }