나는이 목록이 있습니다사전 int 값을 기준으로 사전 목록을 <int, string>으로 주문하려면 어떻게해야합니까?
List<Dictionary<int, string>> list = new List<Dictionary<int, string>>();
을 나는 사전 int 값에 따라 그것 (오름차순)를 주문하고 싶습니다. 내가 어떻게 해?
예 :
Dictionary<int, string> Min1 = new Dictionary<int, string>();
Dictionary<int, string> Min2 = new Dictionary<int, string>();
Dictionary<int, string> Min3 = new Dictionary<int, string>();
Dictionary<int, string> Min4 = new Dictionary<int, string>();
Dictionary<int, string> Min5 = new Dictionary<int, string>();
Min1.Add(3, "name");
Min2.Add(1, "hello");
Min3.Add(5, "marco");
Min4.Add(4, "is");
Min5.Add(2, "my");
List<Dictionary<int, string>> list = new List<Dictionary<int, string>>();
list.Add(Min1);
list.Add(Min2);
list.Add(Min3);
list.Add(Min4);
list.Add(Min5);
// NOW I NEED TO ORDER list BASED ON DICTIONARY INT VALUE
// SO THE ORDER ON THE LIST SHOULD BE Min2, Min5, Min1, Min4, Min3
나는 목록을 정렬하고 싶습니다, 그래서 내가 문자열에 도착하면 내가주기를 내가
당신이 원하는 정렬의 예를 들어 주실 수 있습니까? – Elastep
예제를 추가했습니다 – markzzz
이것은별로 의미가 없습니다. 각 사전의 가장 작은 키로 주문 하시겠습니까? 서로 다른 사전을 비교하기 위해서는 하나의 가치가 있어야하며 어느 사전을 선택해야 하는지를 알아야합니다. –