>DansTonCode();

Tous les codes sourcespage 26

C#
 23 April, 2016 à 10:16
#235
private List<string> GetStringElements(List<Tuple<string, int>> input)
        {
            //From this list of input tuples, return a list which contains only the string component.
            Tuple<List<string>, List<int>> newT = input.Aggregate(Tuple.Create(new List<string>(input.Count), 
                                                    new List<int>(input.Count)), (unpacked, tuple) => { unpacked.Item1.Add(tuple.Item1); 
                                                    unpacked.Item2.Add(tuple.Item2); return unpacked;}); 
            return newT.Item1;
        }