I'm fairly knowledgeable with PHP and very new to C#. Essentially what I'm trying to do is convert the value of a string into that actual name of a variable that already exists. An example would be the following:
string[] Bob = { "Bob", "Belcher", "800-123-12345", "13483" };
string[] James = { "James", "Bond", "555-123-6758", "13484" };
string[] Clark = { "Clark", "Kent", "111-222-3333", "13485" };
string input = Console.ReadLine();
// User types in Bob
// Some magic happens and Bob appears in my WriteLine
Console.WriteLine(Bob[3]);
In this example I have three arrays with information about three people including: first name, last name, phone number and employee number. In my application the user enters their first name and the program spits back their employee number. My problem is getting "Bob" that has been typed by the user to produce Bob the variable.
I know in this specific example I could use an If statement or Switch. But I don't want to be doing that if there is a larger quantity of data.
Dictionary<string, string[]>- or rather,Dictionary<string, Employee>.