Help with matrix in C #

1

I am learning C# on my own and I have tried to make an array from other array but it tells me the following:

  

A nested Array initializer is expected

This is the code:

string[] a = {"pequeña","mediana","grande"};
string[] b = {"esbelto","mediano","gordo"};
string[] c = {"cortas","medianas","largas"};
string[,] poolfen = {a,b,c};
    
asked by Jose Francisco Murga 13.04.2018 в 21:57
source

1 answer

3

You must define a two-dimensional array (matrix) and assign the already created arrays:

String[] a = new String[3] {"pequeña","mediana","grande"};
String[] b = new String[3] {"esbelto","mediano","gordo"};
String[] b = new String[3] {"cortas","medianas","largas"};

String[][] matriz = new String[][] {  a ,  b ,  c };

Console.Write(matriz[1][2]);

Exit:

gordo
    
answered by 13.04.2018 / 22:11
source