Table of Contents

Code Structure - Enums

Enums are value types that assign speaking names to distinct states, categories, or options. Both the individual members, as well as whether an option is available in a collection or not, convey important information.

They help offer an intuitive use model, and any changes need to be carefully managed through C#RA's compatibility approach.

Public enums are defined as part of the C#RA API with clear documentation. Changes to enums follow compatibility guidelines, with additions being compatible and removals/renames requiring major version updates.

Implementation

Enums are defined in the API with XML documentation providing context for users.

namespace Csra {

    /// <summary>
    /// The available output targets for Alert Service messages.
    /// </summary>
    [Flags]
    public enum AlertOutputTarget { OutputWindow = 1, Datalog = 2, File = 4 }

When working with enums internally, careful design ensures that default cases handle unexpected values gracefully. This helps maintain robustness when the enum evolves over time.

Private enums, used only inside implementation without exposure to the user, can be normally defined and used.