C#

C#

Made by DeepSource

Do not prefix enum members with enum's name CS-R1132

Anti-pattern
Major

Enum values are always accessed using the enum's name. Therefore, it does not make any sense to prefix the enum's values with the enum's name. Doing so is repetitive and adds noise to the code.

Bad Practice

enum Season
{
    SeasonSpring,
    SeaonSummer,
    SeaonAutumn,
    SeaonWinter
}

// Prefixing the enum's name adds repetitiveness
var spring = Season.SeasonSpring;

Recommended

enum Season
{
    Spring,
    Summer,
    Autumn,
    Winter
}

// Readable and concise.
var spring = Season.Spring;

Reference