I have a set of data that requires some processing but I want to split the work available threads. How can I change this into a single instruction, preferably removing the for-loop?
string[] keysForThread;
IEnumerable<string> allData;
List<string> dataForSingleThreadToProcess;
for (int i = 0; i < keys.length; i++)
dataForSingleThreadToProcess.AddRange(allData.Where(x => x.StartsWith(keys[i])));
I don’t mind changing the string[] keysForThread into a List and/or the List dataForSingleThreadToProcessinto an IEnumerable.
It sounds like you want: