class C
{
public int Value;
public int[] Items;
}
var data = new C[] { new C() { Value = 1, Items = new int[] { 1, 2, 3 } },
new C() { Value = 10, Items = new int[] { 10, 20, 30 } } };
I'd like to combine Value with value of each Item for each instance of C in data, so the result should be tuples of {1,1}, {1,2}, {1,3}, {10,10}, {10,20}, {10,30}
I already have a procedural solution:
var list = new List<Tuple<int, int>>();
foreach (var c in data)
foreach (var item in c.Items)
list.Add(Tuple.Create(c.Value, item));
But I'd like to know how can I write this in LINQ.