foreach (var cl in compFileName)
{
foreach (var f in fileArray)
{
if (f.Contains(cl))
{
compToCopy.Add(f);
}
}
(sender as BackgroundWorker).ReportProgress(i, Convert.ToString(i));
i++;I'm wondering if there is a more efficient way rather than doing a loop within a loop as even with just 30,000 in the list it takes some time to iterate through!

VulpesRank #55 · 29.2K reputationPosted Sep 9, 2014, 8:35 AM EDT
If it isn't, then you could break from the inner loop after finding a match.
Jay S159 reputationPosted Sep 9, 2014, 9:45 AM EDT