# CaseIdsAttribute

Package: [Microsoft.Orleans.Serialization.Abstractions](/orleans/docs/api/csharp/microsoft.orleans.serialization.abstractions/) 10.0.0

[NuGet package](https://www.nuget.org/packages/Microsoft.Orleans.Serialization.Abstractions) | [Source](https://github.com/dotnet/orleans/blob/4e887e9c914a2f2647fb3c81de963511521dd9cb/src/Orleans.Serialization.Abstractions/Annotations.cs#L354)

```csharp
public sealed class CaseIdsAttribute : Attribute
```

Assigns case identifiers to the cases of a union type which has [GenerateSerializerAttribute](/orleans/docs/api/csharp/microsoft.orleans.serialization.abstractions/orleans.generateserializerattribute/) applied.

## Remarks

Union values are serialized as tagged unions: the case identifier is encoded in the header of the field holding the case value. By default, each case is identified by its zero-based position in the union declaration. This attribute specifies one identifier per case, in declaration order, so that cases can be reordered or removed without changing the identifiers of the remaining cases.

Identifiers must be unique. Identifiers 0 through 6 are encoded without additional bytes.

A union type whose cases are the direct subtypes of a closed type, with the same case identifiers, has the same serialized representation as that closed type (see [CaseAttribute](/orleans/docs/api/csharp/microsoft.orleans.serialization.abstractions/orleans.caseattribute/)). An empty union value is represented as a `null` closed-type value.

## Constructors

- [CaseIdsAttribute(uint[])](/orleans/docs/api/csharp/microsoft.orleans.serialization.abstractions/orleans.caseidsattribute/constructors/constructor-params-uint-array-1-c3092bcd/)

## Properties

- [Ids](/orleans/docs/api/csharp/microsoft.orleans.serialization.abstractions/orleans.caseidsattribute/properties/ids-bf91d442/)
