Skip to content

Add Enum guideline #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/Guidelines(8th Edition).xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<guideline key="Ch09_cc7b10e" severity="AVOID" section="Coding" subsection="Enums">"AVOID creating enums that represent an “incomplete” set of values, such as product version numbers."</guideline>
<guideline key="Ch09_bf80755" severity="AVOID" section="Coding" subsection="Enums">AVOID creating flag enums where the zero value has a meaning other than “no flags are set.”</guideline>
<guideline key="Ch09_a2194dc" severity="AVOID" section="Coding" subsection="Enums">AVOID enums that contain a single value.</guideline>
<guideline key="" severity="DO" section="Coding" subsection="Enums">DO make the enum name itself to be singular (unless the enums are bit flags).</guideline>
<guideline key="Ch09_210817d" severity="DO" section="Coding" subsection="Enums">"DO provide a value of 0 (none) for simple enums, knowing that 0 will be the default value when no explicit initialization is provided."</guideline>
<guideline key="Ch09_590f85a" severity="AVOID" section="Coding" subsection="Enums">AVOID creating “reserved for future use” values in an enum.</guideline>
<guideline key="Ch09_ae9fd04" severity="DO" section="Coding" subsection="Enums">DO use the FlagsAttribute to mark enums that contain flags.</guideline>
Expand Down