CaseAttribute
Namespace: Orleans
closed type which has GenerateSerializerAttribute applied. public sealed class CaseAttribute : AttributeRemarks
When the direct subtypes of a closed type have case identifiers, a field declared as the closed type is serialized as a tagged union: the case identifier is encoded in the header of the field holding the case value, so the runtime type of a value is not encoded when it is exactly the case type. Values whose runtime type derives from an unsealed case type are encoded as that case, followed by their runtime type.
Case identifiers are scoped to the closed type and must be unique within it. Every direct subtype of the closed type must have a case identifier. Case identifiers are part of the serialized format, so they must remain stable once data has been serialized. Identifiers 0 through 6 are encoded without additional bytes.
Adding case identifiers changes writers to the tagged-union format. Adopt them on an existing hierarchy using a coordinated deployment of the updated hierarchy to all processes which exchange these values. Readers generated for the updated hierarchy accept both the runtime-type format and the tagged-union format.
A closed type and a union type have the same serialized representation when the union's cases are the closed type's direct subtypes with the same case identifiers (see CaseIdsAttribute). A null closed-type value is represented as an empty union value. A closed type hierarchy can therefore be replaced by an equivalent union type without changing serialized data. Each case's own representation includes its base type's members, so to remove the closed base from the cases when replacing it with a union, declare the closed base without serialized members and apply SerializerTransparentAttribute to it.
Constructors
CaseAttribute(uint)Initializes a new instance of theCaseAttributeclass.
Properties
IdGets the case identifier.
