Microsoft Visual Studio 2017 Promo Code
Microsoft Office 2016 Promo Code

Enumeration Usage - C# Coding Standard 11

We generally use the Enumerations (enum in short) to avoid magical numbers in C#. In this article we discuss what are the basic standards we need to follow while using enumerations.

             Enums should contain more than one value

             For enums, use abbreviations sparingly

             Don't start or end enumeration name with enum

             Use singular name for most of the enumerations and we can use plural names only for bit fields

             For bit field enumerations, always add FlagsAttribute attribute

             By default enumerations elements values starts from 0(zero). Do not provide explicit values for enums unless it’s required

             By default enum type is Int32. Don't mention type for enums

Add comment


© Copyright 2018 | Sitemap