R
rodchar
hey all,
private static bool Validate(string userInput)
{
string[] validOptions = { "1", "2", "3", "4", "E" };
return
Array.Exists<string>(validOptions,
delegate(string s) { return s.Equals(userInput.ToUpper()); });
}
this validation routine is to my console application's menu option. i was
just wondering if they are other ways to do this. because it smells a little
like what if i put a new option in the menu but forget to add it to the array
(unlikely but just curious) is this something to worry about?
thanks,
rodchar
private static bool Validate(string userInput)
{
string[] validOptions = { "1", "2", "3", "4", "E" };
return
Array.Exists<string>(validOptions,
delegate(string s) { return s.Equals(userInput.ToUpper()); });
}
this validation routine is to my console application's menu option. i was
just wondering if they are other ways to do this. because it smells a little
like what if i put a new option in the menu but forget to add it to the array
(unlikely but just curious) is this something to worry about?
thanks,
rodchar