diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1700.md b/docs/fundamentals/code-analysis/quality-rules/ca1700.md index f87c858c3aa69..cf40d421715a4 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1700.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1700.md @@ -10,6 +10,8 @@ helpviewer_keywords: - CA1700 author: gewarren ms.author: gewarren +dev_langs: +- CSharp --- # CA1700: Do not name enum values 'Reserved' @@ -43,6 +45,10 @@ In a limited number of cases the addition of a member is a breaking change even To fix a violation of this rule, remove or rename the member. +## Example + +:::code language="csharp" source="snippets/csharp/all-rules/ca1700.cs" id="snippet1"::: + ## When to suppress warnings It is safe to suppress a warning from this rule for a member that is currently used or for libraries that have previously shipped. diff --git a/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1700.cs b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1700.cs new file mode 100644 index 0000000000000..3989315053bf6 --- /dev/null +++ b/docs/fundamentals/code-analysis/quality-rules/snippets/csharp/all-rules/ca1700.cs @@ -0,0 +1,22 @@ +namespace ca1700 +{ + // + // This enum violates the rule. + public enum BadPaymentStatus + { + Pending = 0, + Completed = 1, + ReservedError = 2, + Reserved = 3, + } + + // This enum satisfies the rule. + public enum GoodPaymentStatus + { + Pending = 0, + Completed = 1, + Error = 2, + Unknown = 3, + } + // +}