辞書から結果を取得するラムダ式があります。
var sortedDict = (from entry in dctMetrics
orderby entry.Value descending
select entry);
式は必要なペアをプルバックします。IDEのデバッグモードでそれらを確認できます。
これをソースと同じタイプの辞書に戻すにはどうすればよいですか?sortDictのTElementがKeyValuePairであることは知っていますが、ToDictionary拡張メソッドの構文を完全に理解するのに問題があります。また、varの結果を区分的に作成して新しい辞書を作成しようとしましたが、役に立ちませんでした。
このようなものはありますか(機能的に):
var results = (from entry in dictionary
orderby entry.Value descending
select entry);
Dictionary<string,float> newDictionary = results as (Dictionary<string,float>);