link如何對一個文件夾下的數據文件排序,報錯,Index out of range
List data = new List();
foreach (var file in Dictionary.GetFiles("e:\華新采集", "*.txt"))
{
data.AddRange(File.ReadAllLines(file).Skip(2));
}
var query = data.Select(x => x.Split('\t')).GroupBy(x => x[1]).OrderBy(x => x.Key).Select((x, i) => string.Format("{0}\t{1}\t{2}", i + 1, x.Key, x.Sum(y => int.Parse(y[3]))));
File.WriteAllLines("aaa.txt", query);
.GroupBy(x => x[1])
和y[3]
問題多數出在這,這個需要你自己調試一下