Hi there
in c# what is a good way of selecting which method to call based on a
string?
For example, my method can accept a string parameter (there are 50 or so
valid strings that can be passed in), and based on this string I should call
some other specific handler method.
Is there some smart mapping I can make between strings and methods? Some
sort of array like:
"string_one", method_1,
"string_two", method_2
etc
Then my method could match the the passed-in string with the array, and call
the appropriate method.
public void HandleData(string parameter)
{
// find string in array which matches parameter...
// call the associated method....
}
Thanks for any advice,
Peter