diff --git a/docs/csharp/language-reference/operators/snippets/shared/CollectionExpressionExamples.cs b/docs/csharp/language-reference/operators/snippets/shared/CollectionExpressionExamples.cs
index 1683533c85773..b86e8b163a77d 100644
--- a/docs/csharp/language-reference/operators/snippets/shared/CollectionExpressionExamples.cs
+++ b/docs/csharp/language-reference/operators/snippets/shared/CollectionExpressionExamples.cs
@@ -39,7 +39,7 @@ public class CollectionExpressionExamples
internal static void Examples()
{
//
- LineBuffer line = [ 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!' ];
+ LineBuffer line = ['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!'];
//
IEnumerator iter = line.GetEnumerator();
while (iter.MoveNext())
@@ -49,7 +49,7 @@ internal static void Examples()
Console.WriteLine();
//
- Span weekDays = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ];
+ Span weekDays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
foreach (var day in weekDays)
{
Console.WriteLine(day);
@@ -67,7 +67,7 @@ internal static void Examples()
string oxygen = "O";
string fluorine = "F";
string neon = "Ne";
- string[] elements = [ hydrogen, helium, lithium, beryllium, boron, carbon, nitrogen, oxygen, fluorine, neon ];
+ string[] elements = [hydrogen, helium, lithium, beryllium, boron, carbon, nitrogen, oxygen, fluorine, neon];
foreach (var element in elements)
{
Console.WriteLine(element);
@@ -75,10 +75,10 @@ internal static void Examples()
//
//
- string[] vowels = [ "a", "e", "i", "o", "u" ];
- string[] consonants = [ "b", "c", "d", "f", "g", "h", "j", "k", "l", "m",
- "n", "p", "q", "r", "s", "t", "v", "w", "x", "z" ];
- string[] alphabet = [ ..vowels, ..consonants, "y" ];
+ string[] vowels = ["a", "e", "i", "o", "u"];
+ string[] consonants = ["b", "c", "d", "f", "g", "h", "j", "k", "l", "m",
+ "n", "p", "q", "r", "s", "t", "v", "w", "x", "z"];
+ string[] alphabet = [.. vowels, .. consonants, "y"];
//
}
@@ -87,11 +87,11 @@ public class Container
{
//
// Initialize private field:
- private static readonly ImmutableArray _months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
+ private static readonly ImmutableArray _months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
// property with expression body:
public IEnumerable MaxDays =>
- [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
+ [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
public int Sum(IEnumerable values) =>
values.Sum();