SemanticEnumAttribute

Description

sealed class CodeX.SemanticEnumAttribute

Derived from

Attribute abstract

The annotated element is an enumeration with additional semantic meaning with respect to the ordinal values of its items.
- or - The annotated static field is a list that maps the enumeration item ordinals to invariant list index ordinals.

The documentation of a semantic enumeration should describe the additional meaning that is imposed on the ordinal values, which are then subject to the following:

  • The ordinal values of a semantic enumeration will not change between releases, although new values may be added and existing values may be deprecated.

  • The ordinal values of the items in a non-semantic enumeration may change between releases.

These are the most common use cases for semantic enumerations:

  • The ordinal values are stored / retrieved during serialization.

  • The ordinal values encode special information, for example a box in an icon atlas.

  • The ordinal values have been chosen to match constants of 3rd-party APIs.