Is there a way of replacing following 3 levels of nested for-loops into more efficient or cleaner code? Would linq be able to make it more efficient and easy to read?
Please help. Thanks
bool myMatch = false;
foreach (MyEntityClass entitySmallerSet in entitiesSmallerSet)
{
if (entityLargerSet.Key.Equals(entitySmallerSet.Key))
{
foreach (var stringResValLarge in entityLargerSet.StringResourceValues)
{
foreach (var stringResValSmall in entitySmallerSet.StringResourceValues)
{
if (stringResValSmall.Culture.Equals(stringResValLarge.Culture)
&& stringResValSmall.Value.Equals(stringResValLarge.Value))
{
myMatch = true;
}
}
}
}
}
Dictionary<Tuple<Culture, T>, IEnumerable<MyEntityClass>>for each entity for instance, whereTis the type ofValue. What do you think (it's just an idea)?