Comment ajouter de nouveaux éléments à ce tableau?Comment ajouter de nouveaux éléments au tableau multidimensionnel
public static string[,] myArray = new string[,] { { "1", "1a" }, { "2", "2a" } };
public Form1()
{
InitializeComponent();
myArray.add("3", "3a"); // error
for (int i = 0; i < myArray.GetLength(0); i++)
{
Console.WriteLine(myArray[i, 0] +", "+ myArray[i, 1]);
}
}
merci.
Je pense que vous voulez une liste <> ou tout autre type de collection. Les tableaux simples comme celui-ci ont une taille fixe déterminée à l'initialisation. – dbemerlin
merci. J'ai besoin d'une liste –