0

私は以下のようなクラスを持っています:

Class Financial
{
    string Debit;
    string Credit;
    decimal Amount;
}

そして、私はこのクラスのオブジェクトと複数のレコードのリストを持っています。必要なのは、SQLのようにグループ化された合計を実行することだけです

Select debit, Credit, sum(amount) group by Debit, Credit

私は以下のような声明で試しました:

from operation in m_listOperations
    orderby operation.Debit, operation.Credit ascending
    group operation by operation.Debit, operation.Credit into groupedOperation
    select new Financial(Debit, Credit, 
                groupedOperation.Sum(operation => operation.Amount))

しかし、2つの列にグループ化できないため、これは機能しません。

助言がありますか?

4

1 に答える 1

2
...
group operation by new { operation.Debit, operation.Credit } into groupedOperation
...
于 2010-06-07T12:04:00.250 に答える