 
                    
                
         
    
    
    
	
	
		
		
	
		
		
		
			
SortedList<> and 
SortedDictionary<> Class Diagrams

Using 
SortedDictionary<TKey, TValue>

 code
code
 1 using System;
using System;
 2 using System.Collections.Generic;
using System.Collections.Generic;
 3 class Program
class Program
 4

 {
{
 5
 6 static void Main()
    static void Main()
 7
 
     {
{
 8 SortedDictionary<string, string> dictionary = new
        SortedDictionary<string, string> dictionary = new
 9 SortedDictionary<string, string>();
             SortedDictionary<string, string>();
10 int index = 0;
        int index = 0;
11 dictionary.Add(index++.ToString(), "object");
        dictionary.Add(index++.ToString(), "object");
12 dictionary.Add(index++.ToString(), "byte");
        dictionary.Add(index++.ToString(), "byte");
13 dictionary.Add(index++.ToString(), "uint");
        dictionary.Add(index++.ToString(), "uint");
14 dictionary.Add(index++.ToString(), "ulong");
        dictionary.Add(index++.ToString(), "ulong");
15 dictionary.Add(index++.ToString(), "float");
        dictionary.Add(index++.ToString(), "float");
16 dictionary.Add(index++.ToString(), "char");
        dictionary.Add(index++.ToString(), "char");
17 dictionary.Add(index++.ToString(), "bool");
        dictionary.Add(index++.ToString(), "bool");
18 dictionary.Add(index++.ToString(), "ushort");
        dictionary.Add(index++.ToString(), "ushort");
19 dictionary.Add(index++.ToString(), "decimal");
        dictionary.Add(index++.ToString(), "decimal");
20 dictionary.Add(index++.ToString(), "int");
        dictionary.Add(index++.ToString(), "int");
21 dictionary.Add(index++.ToString(), "sbyte");
        dictionary.Add(index++.ToString(), "sbyte");
22 dictionary.Add(index++.ToString(), "short");
        dictionary.Add(index++.ToString(), "short");
23 dictionary.Add(index++.ToString(), "long");
        dictionary.Add(index++.ToString(), "long");
24 dictionary.Add(index++.ToString(), "void");
        dictionary.Add(index++.ToString(), "void");
25 dictionary.Add(index++.ToString(), "double");
        dictionary.Add(index++.ToString(), "double");
26 dictionary.Add(index++.ToString(), "string");
        dictionary.Add(index++.ToString(), "string");
27
28 Console.WriteLine("Key  Value   Hashcode");
        Console.WriteLine("Key  Value   Hashcode");
29 Console.WriteLine("---  ------  --------");
        Console.WriteLine("---  ------  --------");
30 foreach (KeyValuePair<string, string> i in dictionary)
        foreach (KeyValuePair<string, string> i in dictionary)
31
 
         {
{
32 Console.WriteLine("{0,-5}{1,-9}{2}",
            Console.WriteLine("{0,-5}{1,-9}{2}",
33 i.Key, i.Value, i.Key.GetHashCode());
                i.Key, i.Value, i.Key.GetHashCode());
34 }
        }
35
36 Console.ReadKey();
        Console.ReadKey();
37 }
    }
38 }
} 
    .jpg) 
  
 
		 
		posted @ 
2007-05-11 09:28 
南守拥 
阅读(
197) 
评论() 
 
收藏 
举报