From 545bc975a71f8be4a8f3a92bfe476bccbbdfa7b3 Mon Sep 17 00:00:00 2001 From: Stuart Mosquera Date: Mon, 9 Feb 2026 23:22:22 -0300 Subject: [PATCH 1/2] Update arrays.md --- content/c-sharp/concepts/arrays/arrays.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/content/c-sharp/concepts/arrays/arrays.md b/content/c-sharp/concepts/arrays/arrays.md index d0f3f96b3db..c900f023185 100644 --- a/content/c-sharp/concepts/arrays/arrays.md +++ b/content/c-sharp/concepts/arrays/arrays.md @@ -24,11 +24,21 @@ type[] arrayName; // Create the array variable and initialize it with an array of N items: type[] arrayName = new type[N]; +// Classic Syntax + // Create the array variable and initialize it by specifying the contents: type[] arrayName = new type[] { value1, value2, value3, ... valueN }; // Alternative way of creating the array and specifying the contents: type[] arrayName = { value1, value2, value3, ... valueN }; + +// Collection Expression Syntax (C# 12+) + +// Create an empty array: +type[] arrayName = []; + +// Create the array variable and initialize it by specifying the contents: +type[] arrayName = [ value1, value2, value3, ... valueN ] ``` > **Note:** Arrays in C# have a set size, meaning the number of elements they hold cannot be changed once the array has been created. @@ -44,8 +54,8 @@ public class Example { public static void Main(string[] args) { - char[] vowels = {'a', 'e', 'i', 'o', 'u'}; - // indexes: 0 1 2 3 4 + char[] vowels = [ 'a', 'e', 'i', 'o', 'u' ]; + // indexes: 0 1 2 3 4 Console.WriteLine(vowels[0]); // Output: a From d99f773f3c7e0afc3d7c1972f3e485f28737dfe8 Mon Sep 17 00:00:00 2001 From: Daksha Deep Date: Thu, 19 Feb 2026 14:38:29 +0530 Subject: [PATCH 2/2] missing semicolon --- content/c-sharp/concepts/arrays/arrays.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/c-sharp/concepts/arrays/arrays.md b/content/c-sharp/concepts/arrays/arrays.md index c900f023185..140bcc5617d 100644 --- a/content/c-sharp/concepts/arrays/arrays.md +++ b/content/c-sharp/concepts/arrays/arrays.md @@ -38,7 +38,7 @@ type[] arrayName = { value1, value2, value3, ... valueN }; type[] arrayName = []; // Create the array variable and initialize it by specifying the contents: -type[] arrayName = [ value1, value2, value3, ... valueN ] +type[] arrayName = [ value1, value2, value3, ... valueN ]; ``` > **Note:** Arrays in C# have a set size, meaning the number of elements they hold cannot be changed once the array has been created.