CSV ファイルからソートされたデータを取得しようとしています。このコードは、文字列であり、1 つのグループで同じ「Side」列を除いて正常に機能します。First() メソッドの Single() に必要なパラメーターがわかりません。
var stuff = from line in File.ReadLines(@"d:\tmp\4.csv").Skip(1)
let columns = line.Split(';')
select new
{
Time = columns[0],
Side = columns[2],
Qty = columns[3],
Symbol = columns[4],
Price = columns[5],
};
var sorted = from line in stuff
group line by new { line.Time, line.Symbol }
into category
select new {
category.Key.Time,
category.Key.Symbol,
Qty = category.Sum(p => Int32.Parse(p.Qty)),
Price = category.Average(p => double.Parse(p.Price)),
Side = ?????? };