asp.net 용 C# 2.0에서 사전 객체를 어떻게 정렬합니까, 아니면 사전 정렬을위한 Dictionay 대신 알파벳 순으로 국가 목록 정렬Dictionary <string, string> asp.net 2.0 또는 대안의 객체 및 정렬
2
A
답변
4
SortedDictionary<TKey, TValue>
클래스를 찾고 있는데, 이는 키에 의해 자동으로 정렬됩니다. 당신은 System.Collections의 SortedList를 시도 할 수 있습니다
List<string> values = new List<string>(dict.Values);
values.Sort();
2
사용하십시오 SortedDictionary
0
: 당신이 값을 정렬 할 경우
, 당신은 List<string>
를 사용할 수 있습니다. 제네릭 버전 (System.Collections.Generic.SortedList)도 있습니다.
여기 MSDN의 link입니다.
관련 문제
- 1. 사전 <string, Dictionary <string, string >>을 LINQ를 사용하여 내부 Dictionary 값의 값으로 정렬 하시겠습니까?
- 2. Dictionary <string, Dictionary <string, object >>에 항목을 추가하는 방법은 무엇입니까?
- 3. Dictionary <string, string, Dictionary <string, string >>처럼 보이는 것을 구현하는 좋은 방법은 무엇입니까?
- 4. WCF에서 Dictionary <string, string>을 (를) 사용하는 방법?
- 5. Dictionary <string, string>을 Dictionary <string, object>로 변환하는 가장 희박한 방법은 무엇입니까?
- 6. 일부 메서드에서 Dictionary <string, string> 개체를 전달하는 방법
- 7. 비교 2 목록 <Dictionary <string, object >>
- 8. Dictionary <string, object> from object mapper
- 9. System.Collections.Generic.Dictionary <string, string>
- 10. IDictionary <string, string> 또는 NameValueCollection
- 11. DataContractSerializer를 사용하여 Dictionary <string, List <string>>을 serialize하는 방법은 무엇입니까?
- 12. ASP.NET 2.0 또는 3.5?
- 13. Dictionary <Enum, string>()은 mvc의 모델에 바인딩하지 않습니다.
- 14. ProtoBuf-net에서 Dictionary <string, object>를 직렬화하지 못했습니다.
- 15. Dictionary <string, object>의 키를 정렬 된 문자열로 가져 오는 방법
- 16. ListView를 ArrayAdapter로 정렬 <String>
- 17. Dictionary <> 항상 값에서 정렬, 키에서 색인 조회
- 18. 사전을 포함한 <string, string> 사전
- 19. protobuf-net v2 alpha - Dictionary <string, string> 관련 문제?
- 20. Asp.net : <% # 또는 <%
- 21. JQuery와 및 정렬 정적 객체
- 22. 다른 대안의 usercontrol
- 23. <사전 <int, string>>
- 24. MOQ -하여 Dictionary <문자열 두 번> 객체
- 25. Dictionary <string, string>에 대한 강력한 형식의 래퍼를 만드는 가장 좋은 방법
- 26. System.Json을 사용하여 Dictionary <string, string>을 json 문자열로 변환하려면 어떻게해야합니까?
- 27. XML을로드하지만 asp.net 2.0 용
- 28. JAXB to unmarshall <string> foobar</string>
- 29. String 객체 인스턴스
- 30. Dictionary
나는 언어 목록이 정렬되지 않은 국가 목록을 원합니다. – ONYX
사전은 무엇인가요? – SLaks