It is not that difficult, but I cannot wrap it in linq.
I have an Enumerable<T> containing an Enumerable<string> :
public class { List<List<string>> ListOfLists = new List<List<string>>(); }
Basically I want to return every unique row from ListOfLists; this is easy to use with a foreach loop and a storage variable (I could probably increase the effectiveness of not having a clear one at the very end, but itβs not):
List<string> result = new List<string>(); foreach (var v in ListOfLists) { foreach (var s in v) { result.Add(s); } } result.Distinct();
How to do it with linq?
source share