// slightly neater. public List<Tuple<int, char>> Attempt2(List<char> l) { var p9Instance = new P9(); var groupedList = p9Instance.Compress(l); var rleList = (from ll in groupedList select new Tuple<int, char>( ll.Count, ll[0])).ToList(); return rleList; }
// very obvious approach public List<Tuple<int, char>> Attempt1(List<char> l) { var p9Instance = new P9(); var groupedList = p9Instance.Compress(l); var rleList = new List<Tuple<int, char>>(); foreach (var group in groupedList) { rleList.Add(new Tuple<int, char>(group.Count, group[0])); } return rleList; }