C#

C#

Made by DeepSource

Values in an enum should be unique CS-W1088

Bug risk
Critical

Values in an enum should always be unique. Having 2 different members of an enum carry the same value is likely a mistake. Since such a flawed value can affect how your application behaves, it is recommended that you fix it as soon as possible.

Bad Practice

enum ErrorCode
{
    None = 0,
    Unknown = 1,
    ConnectionLost = 100,
    OutlierReading = 100 // Likely a mistake
}

Recommended

enum ErrorCode : ushort
{
    None = 0,
    Unknown = 1,
    ConnectionLost = 100,
    OutlierReading = 200
}

Reference