如何在C#.Net中创建我自己的字典
问题描述:
字典的内部实现< tkey,tvalue>使用C#.Net编码
Internal Implimentation of Dictionary<tkey,tvalue> using C#.Net coding
答
http: //msdn.microsoft.com/zh-CN/library/xfhwa508.aspx [^ ]
希望这会有所帮助.http://www.c-sharpcorner.com/UploadFile/mahesh/how-to-create-a-dictionary-in-C-Sharp/[^]
hope this will help.
检查以下内容:
Check this:
Dictionary<object, string> dict = new Dictionary<object, string>(); object myObj = new object(); object myObj2 = new object(); dict[myObj] = "myObj1"; dict.Add(myObj2, "myObj2"); Console.WriteLine(dict[myObj] + ' ' + dict[myObj2]);
不过,您不必使用对象和字符串作为键和值类型.
还要检查这篇文章:
带有自定义键的词典 [
You don''t necessary have to use object and string as your key and value types, though.
Also check this article:
Dictionary with a Custom Key[^]