あなたは非常に近いですが、あなたは下降したいように聞こえる:
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
var teams = new Dictionary<string, List<string>>();
teams.Add("Short List", new List<string> {"One","Two"});
teams.Add("Medium List", new List<string> {"One","Two", "Three"});
teams.Add("Long List", new List<string> {"One","Two", "Three", "Four"});
foreach (var kvp in teams.OrderByDescending(x => x.Value.Count))
{
Console.WriteLine("Team {0} has {1} items.", kvp.Key, kvp.Value.Count);
}
}
}
出力:
Team Long List has 4 items.
Team Medium List has 3 items.
Team Short List has 2 items.
.NET Fiddleでそれをチェックアウト。
コードを投稿してください – maxspan