SortedDictionaryGeneric and SortedListGeneric
2007-05-11 09:28
429 查看
SortedList<> and SortedDictionary<> Class Diagrams
using System;
2using System.Collections.Generic;
3class Program
4{
5
6 static void Main()
7 {
8 SortedDictionary<string, string> dictionary = new
9 SortedDictionary<string, string>();
10 int index = 0;
11 dictionary.Add(index++.ToString(), "object");
12 dictionary.Add(index++.ToString(), "byte");
13 dictionary.Add(index++.ToString(), "uint");
14 dictionary.Add(index++.ToString(), "ulong");
15 dictionary.Add(index++.ToString(), "float");
16 dictionary.Add(index++.ToString(), "char");
17 dictionary.Add(index++.ToString(), "bool");
18 dictionary.Add(index++.ToString(), "ushort");
19 dictionary.Add(index++.ToString(), "decimal");
20 dictionary.Add(index++.ToString(), "int");
21 dictionary.Add(index++.ToString(), "sbyte");
22 dictionary.Add(index++.ToString(), "short");
23 dictionary.Add(index++.ToString(), "long");
24 dictionary.Add(index++.ToString(), "void");
25 dictionary.Add(index++.ToString(), "double");
26 dictionary.Add(index++.ToString(), "string");
27
28 Console.WriteLine("Key Value Hashcode");
29 Console.WriteLine("--- ------ --------");
30 foreach (KeyValuePair<string, string> i in dictionary)
31 {
32 Console.WriteLine("{0,-5}{1,-9}{2}",
33 i.Key, i.Value, i.Key.GetHashCode());
34 }
35
36 Console.ReadKey();
37 }
38}
using System;
2using System.Collections.Generic;
3class Program
4{
5
6 static void Main()
7 {
8 SortedDictionary<string, string> dictionary = new
9 SortedDictionary<string, string>();
10 int index = 0;
11 dictionary.Add(index++.ToString(), "object");
12 dictionary.Add(index++.ToString(), "byte");
13 dictionary.Add(index++.ToString(), "uint");
14 dictionary.Add(index++.ToString(), "ulong");
15 dictionary.Add(index++.ToString(), "float");
16 dictionary.Add(index++.ToString(), "char");
17 dictionary.Add(index++.ToString(), "bool");
18 dictionary.Add(index++.ToString(), "ushort");
19 dictionary.Add(index++.ToString(), "decimal");
20 dictionary.Add(index++.ToString(), "int");
21 dictionary.Add(index++.ToString(), "sbyte");
22 dictionary.Add(index++.ToString(), "short");
23 dictionary.Add(index++.ToString(), "long");
24 dictionary.Add(index++.ToString(), "void");
25 dictionary.Add(index++.ToString(), "double");
26 dictionary.Add(index++.ToString(), "string");
27
28 Console.WriteLine("Key Value Hashcode");
29 Console.WriteLine("--- ------ --------");
30 foreach (KeyValuePair<string, string> i in dictionary)
31 {
32 Console.WriteLine("{0,-5}{1,-9}{2}",
33 i.Key, i.Value, i.Key.GetHashCode());
34 }
35
36 Console.ReadKey();
37 }
38}
相关文章推荐
- Python Container Dictionary And List
- DictionaryGeneric and Hashtable
- [C#]泛型与非泛型集合类的区别及使用例程,包括ArrayList,Hashtable,List<T>,Dictionary<Tkey,Tvalue>,SortedList<Tkey,Tvalue>,
- C#集合类详解,Hashtable、Dictionary、SortedList、SortedLi、Array、ArrayList、List、Stack、SortedDictionar
- .NET Generics (Generic Collection / List / Dictionary Classes)
- 数据结构之“Ordered List and Sorted List”(三)
- Remove Duplicates from Sorted List II simple and fast
- 常用数据结构及复杂度 array、LinkedList、List、Stack、Queue、Dictionary、SortedDictionary、HashSet、SortedSet
- Get a List of Keys From a Dictionary in Both Python 2 and Python 3
- python——list and dictionary
- SortedList<TKey,TValue> 和 SortedDictionary<TKey,TValue>
- The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[BMS.DataAccess.Models.ServiceTyp
- k-SLAM:k-mer Sorted List Alignment and Metagenomics
- 数据结构之“Ordered List and Sorted List”(五)
- IDictionary Options - Performance Test - SortedList vs. SortedDictionary vs. Dictionary vs. Hashtabl
- .NET源码中的SortedDictionary<TKey, TValue>和SortedList<TKey, TValue>
- 数据结构之“Ordered List and Sorted List”(四)
- (java) Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
- .NET Framework Generic Collection / List / Dictionary Classes in C#
- 数据结构之“Ordered List and Sorted List”(一)