如何在C#.Net中创建我自己的字典 [英] How To create My own Dictionary in C#.Net

查看:1105
本文介绍了如何在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[^]


这篇关于如何在C#.Net中创建我自己的字典的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆