I'm fairly new to programming and I had a hard time coming up with a title for my question. Let me try to explain it a bit better:
I have a for loop that iterates through a list of strings
for (int i = 0; i < StringList.Count; i++)
{
}
The strings have a general pattern: The list starts with:
- String1
- String2
- String3
- String4
- String5
Then there is a possibility of StringT and StringB occuring randomly. After either string5 or the possible combinations of StringT or StringB occuring it goes back to a string1-5 and starts all over again. (Strings 1-5 are all slightly different but similar enough for filtering purposes). StringT and StringB both have identifying "features" I couldcheck in a if-statement
My Goal is:
Add the first 5 Strings to a TempString and check the possibillity of StringT or StringB being there. If they are there, add them to the TempString too. After That I'm adding the temp string to a list so list[0] would consist of (string1, string2, string3, string 4, string 5 and MAYBE StringT and or StringB)
Repeat the process after that until the loop is finished.
I tried it with a foreach loop and I tried solutions similar to this question: how to loop over generic List<T> and group per 3 items but none of them worked with the possibillity of random strings being there (at least for me)