I am trying to use a string to identify my array. I have a method that takes in the string as a parameter and I wanted to use the value of that string to identify which array to edit.
class Test{
static string[] myNums = { "1","2","3","4" };
static string[] myNames = { "Bill", "Peter", "Michael", "Samir" };
public Test
{
int choice = Int32.Parse(Console.ReadLine());
if(choice == 1)
ProcessAccount("myNums");
else if(choice == 2)
ProcessAccount("myNames");
}
public void ProcessAccount(string id)
{
//This is where I want to identify the array to modify
//based on the ID so I do not have to do separate lines of code
id[0] = "PAST DUE"; //something like this
}
}
Is there any way to do this?