c#中,关键字不在字典中是什么意思啊?

来源:百度知道 编辑:UC知道 时间:2024/06/17 02:32:18

使用 C# Dictionary 字典 
说明
    必须包含名空间System.Collection.Generic 
    Dictionary里面的每一个元素都是一个键值对(由二个元素组成:键和值) 
    键必须是唯一的,而值不需要唯一的 
    键和值都可以是任何类型(比如:string, int, 自定义类型,等等) 
    通过一个键读取一个值的时间是接近O(1) 
    键值对之间的偏序可以不定义
使用方法:
    //定义
    Dictionary<string, string> openWith = new Dictionary<string, string>();
 
    //添加元素
    openWith.Add("txt", "notepad.exe");
    openWith.Add("bmp", "paint.exe");
    openWith.Add("dib", "paint.exe");
    openWith.Add(&qu