YamlUnionCaseInfo Class
Describes a single case of a C# union type to a YamlTypeClassifierFactory.
public sealed class YamlUnionCaseInfoConstructors
| Name | Description |
|---|---|
| YamlUnionCaseInfo(Type, YamlUnionCaseShape, IReadOnlyList<YamlUnionCaseProperty>?, bool) | Initializes a new instance of the YamlUnionCaseInfo class. |
YamlUnionCaseInfo(Type, YamlUnionCaseShape, IReadOnlyList<YamlUnionCaseProperty>?, bool)
YamlUnionCaseInfo.csInitializes a new instance of the YamlUnionCaseInfo class.
public YamlUnionCaseInfo(Type caseType, YamlUnionCaseShape shape, IReadOnlyList<YamlUnionCaseProperty>? properties = null, bool disallowUnmappedProperties = false)Parameters
caseTypeType- The declared case type.
shapeYamlUnionCaseShape- The YAML shape the case is represented by.
propertiesIReadOnlyList<YamlUnionCaseProperty>?- The mapping keys declared by the case, or
nullwhen the case does not serialize as an object mapping. disallowUnmappedPropertiesbool- Whether the case rejects mapping keys it does not declare.
Exceptions
ArgumentNullExceptioncaseTypeisnull.ArgumentException- A property entry is
null.
Properties
| Name | Description |
|---|---|
| CaseType | Gets the declared case type. |
| DisallowUnmappedProperties | Gets a value indicating whether the case rejects mapping keys it does not declare. |
| HasObjectProperties | Gets a value indicating whether the case serializes as an object mapping whose keys are known. A mapping case backed by a dictionary has no declared keys and therefore reports false. |
| Properties | Gets the mapping keys declared by the case. |
| Shape | Gets the YAML shape the case is represented by. |
CaseType
YamlUnionCaseInfo.csDisallowUnmappedProperties
YamlUnionCaseInfo.csHasObjectProperties
YamlUnionCaseInfo.csProperties
YamlUnionCaseInfo.csGets the mapping keys declared by the case.
public IReadOnlyList<YamlUnionCaseProperty> Properties { get; }Property value
Shape
YamlUnionCaseInfo.csGets the YAML shape the case is represented by.
public YamlUnionCaseShape Shape { get; }