So I'm wondering what would be the correct approach to checking a response,
Example -
response = "43";
then if I use
if(response.Contains("4")) {
//do code
}
if(response.Contains("3")) {
//do code
}
both would be equally true, therefore both executing a function, however I want it to be equal to start and end of string, so I'm using -
if(response.Equals("3")) {
//do code
}
therefore the above function would only execute if it WAS EQUAL TO 3 not containing 3? ( Please correct me if I'm wrong )
However for one statement I want to check for multiple strings/integers. So it would be more efficient for my if statement to check each item in a list, rather than repeat
response.Equals(".") && response.Equals(".") etc etc
how could do I do this?
So check if response is equal to any item in
List<string> mylist = new List<string>(new string[] { "1", "2", "3" });
preferably without a for loop..