Hi,
I'm creating a collection of one to one mappings from Foo to Baa.
Baa contains a collection of unique instances of Foo.
Here's some code that does the job:
Dictionary<Foo, Baa> mappings = new Dictionary<Foo, Baa>();
foreach (Baa baa in CollectionOfBaa)
{
foreach (Foo foo in baa.CollectionOfFoo)
{
mappings.Add(foo, baa);
}
}
Is there a better way to do this using LINQ?
I'm not adverse to replacing the dictionary with a list of KeyValuePair.
Thanks.