File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
docs/fundamentals/code-analysis/quality-rules Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ The following example shows two violations of the rule:
3737``` csharp
3838class C
3939{
40- private static readonly string StaticField ;
40+ private static readonly string StaticField = " Format one value: {0} " ;
4141
4242 static void Main ()
4343 {
@@ -54,15 +54,14 @@ The following example shows code that fixes both violations:
5454``` csharp
5555class C
5656{
57- private static readonly string StaticField ;
57+ private static readonly CompositeFormat StaticField = CompositeFormat . Parse ( " Format one value: {0} " ) ;
5858
5959 static void Main ()
6060 {
61- CompositeFormat cf = CompositeFormat .Parse (StaticField );
62- _ = string .Format (null , cf , 42 );
61+ _ = string .Format (null , StaticField , 42 );
6362
6463 StringBuilder sb = new ();
65- sb .AppendFormat (null , cf , 42 );
64+ sb .AppendFormat (null , StaticField , 42 );
6665 }
6766}
6867```
You can’t perform that action at this time.
0 commit comments