C# Language Naming Conventions Enums

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Use a singular name for most Enums

public enum Volume
{
   Low,
   Medium,
   High
}

Use a plural name for Enum types that are bit fields

[Flags]
public enum MyColors
{
    Yellow = 1,
    Green = 2,
    Red = 4,
    Blue = 8
}

Note: Always add the FlagsAttribute to a bit field Enum type.

Do not add 'enum' as a suffix

public enum VolumeEnum // Incorrect

Do not use the enum name in each entry

public enum Color
{
    ColorBlue, // Remove Color, unnecessary
    ColorGreen,
}


Got any C# Language Question?