I create a list<string> machineTypes
and fill it with data. I want to check to see if the collection contains any combination of strings. My initial plan was to use a for loop, but obviously I can't check multiple indexes in the middle of a for loop.
for (int i = 0; i < machineTypes.Count; i++)
{
if (machineTypes[i] == "W")
//do stuff
if ((machineTypes[i] == "P") && (machineTypes[i] == "W") && (machineTypes[i] == "A") && (machineTypes[i] == "C"))
//do stuff
}
So I'm looking for suggestions as to the best way to do this. I suppose I could use String.Join
, but I was wondering if there was a more elegant way.