samedi 11 juillet 2020

How to find a reference to an array by the name of the variable as defined in the code in C#?

Obviously, I'm not looking for the classic:

string[] garden = {"Tulip"};
Console.WriteLine(garden[0]);

but rather, doing the same with a string:

string[] garden = {"Tulip"};
string gardenname = "garden";
string[] cool_NEW_array = ArrayByName(gardenname);
Console.WriteLine(cool_NEW_array[0])

I'm curious as to whether there is some actually existing version of "ArrayByName" which would let me find an array by using a string which is its name. Thanks in advance!





Aucun commentaire:

Enregistrer un commentaire