欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ASP.NET Dictionary 的基本用法示例介紹

 更新時間:2014年01月09日 16:15:04   作者:  
ASP.NET中的Dictionary想必使用.net的朋友并不陌生吧,下面以示例的方式為大家介紹下其基本用法,感興趣的朋友可以參考下

復(fù)制代碼 代碼如下:

Dictionary<string, string> o_Dic = new Dictionary<string, string>();
//添加元素
o_Dic.Add("01", "aaa");
o_Dic.Add("02","bbb");
//判斷某個key是否存在
if (!o_Dic.ContainsKey("03"))
{
o_Dic.Add("03", "ccc");
}
//移除某個
o_Dic.Remove("03");
//取某個的值
string a = o_Dic["02"];
//遍歷
foreach (KeyValuePair<string, string> kvp in o_Dic)
{
Response.Write(kvp.Key + "," + kvp.Value);
}
//遍歷key
foreach (string s in o_Dic.Keys) { }
//遍歷value
foreach (string s in o_Dic.Values) { }

相關(guān)文章

最新評論