How to perform this without iteration, with LINQ?
string[] flatSource = {"region1", "subregion1",
"region2", "sub1", "sub2",
"region3", "sub1", "sub2"};
string previousRegion = "";
foreach (var item in flatSource)
{
if (SomeRegionDictionary.Contains(item))
previousRegion = item; //This is what I can't figure out
else
yield return new SubregionWithRegion{Region = previousRegion, SubRegion = item};
}