1

一般的な値で Dictionary オブジェクトをソートしようとしました。

これが私のコードです

Dictionary<string, ReportModel> sortedDic = new Dictionary<string, ReportModel>();
Dictionary<string, ReportModel> rDic = new Dictionary<string, ReportModel>();
var ordered = sortedDic.OrderByDescending(x => x.Value.totalPurchase);
foreach (var item in ordered)
{                           
    rDic.Add(item.Key, item.Value);
}

変数、ordered は、sortedDic と同じ順序になっています。これの何が問題なのですか?何か案が?

4

2 に答える 2