DictionaryGeneric and Hashtable
2007-05-11 09:24
302 查看
Dictionary and Hashtable Class Diagrams
using System;
2 using System.Collections.Generic;
3
4 class Program
5using System;
2using System.Collections.Generic;
3
4class Program
5using System;
2using System.Collections.Generic;
3class Program
4{
5
6 static void Main()
7 {
8 Dictionary<string, string> dictionary = new
9 Dictionary<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;
2 using System.Collections.Generic;
3
4 class Program
5using System;
2using System.Collections.Generic;
3
4class Program
5using System;
2using System.Collections.Generic;
3class Program
4{
5
6 static void Main()
7 {
8 Dictionary<string, string> dictionary = new
9 Dictionary<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}
相关文章推荐
- CSharp - Collections(List, Dictionary) vs Generic collections(ArrayList, HashTable)
- hashtable and dictionary
- SortedDictionaryGeneric and SortedListGeneric
- :java collections读书笔记(6) Dictionary and hashtable
- 论文阅读 Sesame: A Generic Architecture for Storing and Querying RDF and RDF Schema
- Hashtable 和 Dictionary [可看]
- ArrayList、HashTable、List、Dictionary的演化及如何选择使用
- The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[BMS.DataAccess.Models.ServiceTyp
- C#基础课程之五集合(HashTable,Dictionary)
- c#中Dictionary、ArrayList、Hashtable和数组的区别是什么?[转]
- Generic Repository Pattern - Entity Framework, ASP.NET MVC and Unit Testing Triangle
- C# 创建 Hashtable、Dictionary、ArrayList 等对象的简写方法
- C#中Dictionary、ArrayList、Hashtable和Array的区别
- What is difference between HashMap and Hashtable in Java?
- XML Serializable Generic Dictionary
- 个人对 HashTable 和 Dictionary的区别总结
- 浅析几种数据集合(Dictionary、ArrayList、Hashtable和Array)的区别
- C#集合类(HashTable, Dictionary, ArrayList)与HashTable线程安全
- C# 集合类 Array Arraylist List Hashtable Dictionary Stack Queue
- ArrayList,Hashtable,List<T>,Dictionary<K,V>