SortedDictionaryGeneric and SortedListGeneric

it2022-05-09  27

SortedList<> and SortedDictionary<> Class Diagrams Using SortedDictionary<TKey, TValue> code 1using System; 2using System.Collections.Generic; 3class Program 4{ 5 6    static void Main() 7    { 8        SortedDictionary<stringstring> dictionary = new 9             SortedDictionary<stringstring>();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");2728        Console.WriteLine("Key  Value   Hashcode");29        Console.WriteLine("---  ------  --------");30        foreach (KeyValuePair<stringstring> i in dictionary)31        {32            Console.WriteLine("{0,-5}{1,-9}{2}",33                i.Key, i.Value, i.Key.GetHashCode());34        }3536        Console.ReadKey();37    }38}

转载于:https://www.cnblogs.com/nanshouyong326/archive/2007/05/11/742502.html

相关资源:七夕情人节表白HTML源码(两款)

最新回复(0)