K
K Viltersten
I have the following passage working well.
List<T> list1D = new List<T>();
List<List<T>> list2D = new List<List<T>>();
foreach (T item in list1D)
list2D.Add(list1D.Where(
x => x.prop == item.prop
).ToList());
I can't help wondering, though, if it's
possible to re-express the LINQ query in
such a way so we actually don't use the
foreach statement at all.
I'm not saying it's wise, requested nor
readable with the redesign. Just being
curious if it's possible and if so, how.
List<T> list1D = new List<T>();
List<List<T>> list2D = new List<List<T>>();
foreach (T item in list1D)
list2D.Add(list1D.Where(
x => x.prop == item.prop
).ToList());
I can't help wondering, though, if it's
possible to re-express the LINQ query in
such a way so we actually don't use the
foreach statement at all.
I'm not saying it's wise, requested nor
readable with the redesign. Just being
curious if it's possible and if so, how.