當我運行這段代碼:List.Aggregate意想不到的結果
List<string> list = new List<string>();
list.Add("a");
list.Add("b");
list.Add("c");
list.Add("d");
string s = list.Aggregate((total, item) => total += item + ",");
我希望使他能:
a,b,c,d,
而是s是:
ab,c,d,
誰能告訴我爲什麼不在第一個和第二個索引之間添加逗號?
感謝
這據說,我更喜歡菲爾的版本。 –
感謝您的快速響應! – Matt