diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1863.md b/docs/fundamentals/code-analysis/quality-rules/ca1863.md index 0fc4a645d4e29..80b8ea5ecb744 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1863.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1863.md @@ -37,7 +37,7 @@ The following example shows two violations of the rule: ```csharp class C { - private static readonly string StaticField; + private static readonly string StaticField = "Format one value: {0}"; static void Main() { @@ -54,15 +54,14 @@ The following example shows code that fixes both violations: ```csharp class C { - private static readonly string StaticField; + private static readonly CompositeFormat StaticField = CompositeFormat.Parse("Format one value: {0}"); static void Main() { - CompositeFormat cf = CompositeFormat.Parse(StaticField); - _ = string.Format(null, cf, 42); + _ = string.Format(null, StaticField, 42); StringBuilder sb = new(); - sb.AppendFormat(null, cf, 42); + sb.AppendFormat(null, StaticField, 42); } } ```