About 562,000 results
Open links in new tab
  1. c# - How can I declare a two dimensional string array? - Stack Overflow

    Oct 3, 2019 · To declare a two-dimensional array, use this syntax: string[,] tablero = new string[3, 3]; If you really want a jagged array , you need to initialize it like this:

  2. C# - 2D Array of String Arrays - Stack Overflow

    However, in the World Class, I want to create a two-dimensional array that can hold all of the Map's string arrays. I have tried: public static string[,][] Map = new string[,][] { { A1 , A2 }, { B1 , B2 }, };

  3. C# Multidimensional Arrays - W3Schools

    To access an element of a two-dimensional array, you must specify two indexes: one for the array, and one for the element inside that array. Or better yet, with the table visualization in mind; one for the row and one for the column (see example below).

  4. C# Multidimensional Arrays - GeeksforGeeks

    Jan 15, 2025 · Two-Dimensional Array is the first step to make an array multidimensional. 2-D array can be interpreted as a collection of multiple One-Dimensional Arrays. The above syntax is a good way only when we need for user input array. For …

  5. How to use C# convert 2 dimensional array string[,] to string

    May 6, 2015 · Here is a way with 2 nested loops: var sb = new StringBuilder(temp.GetUpperBound(1)+1); for (int j = 0; j<=temp.GetUpperBound(1); j++) sb.Append(temp[i,j]); output[i] = sb.ToString();

  6. Arrays of Strings in Multidimensional Arrays - C# Corner

    Sep 9, 2024 · Multidimensional arrays store data in multiple levels, enabling complex data structures like arrays of strings. This guide explores how to create, access, and manipulate string arrays within multidimensional arrays.

  7. The array reference type - C# reference | Microsoft Learn

    Dec 14, 2024 · In the preceding example, even though the type is string[], an array of non-nullable strings, the default value for each element is null. The best way to initialize an array to non-null values is to use a collection expressions.

  8. C# - 2D Array Examples - Dot Net Perls

    Nov 29, 2023 · We can create 2D arrays of any element type. We can initialize 2D arrays with a single statement—all the memory is part of a single region. Also remember that jagged arrays can represent a 2D space. 2D example. Here we show a 2-dimensional string array.

  9. Working with Multidimensional String Arrays in C#

    Jul 24, 2024 · To create a multidimensional string array in C#, you can use the following syntax: string[,] multiArray = new string[3, 3]; In this example, we are creating a 2D string array with 3 rows and 3 columns.

  10. C# 2D Array Examples - The Developer Blog

    C# program that creates 2D array using System; class Program { static void Main() {// Part A: create 2D array of strings. string[,] array = new string[,] { {"cat", "dog"}, {"bird", "fish"}, }; // Part B: access (and print) values.