您现在的位置是:网站首页> 编程资料编程资料
ASP.NET Dictionary 的基本用法示例介绍_实用技巧_
2023-05-24
346人已围观
简介 ASP.NET Dictionary 的基本用法示例介绍_实用技巧_
复制代码 代码如下:
Dictionary
//添加元素
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
{
Response.Write(kvp.Key + "," + kvp.Value);
}
//遍歷key
foreach (string s in o_Dic.Keys) { }
//遍歷value
foreach (string s in o_Dic.Values) { }
您可能感兴趣的文章:
相关内容
- litjson读取数据示例_实用技巧_
- asp.net创建位图生成验证图片类(验证码类)_实用技巧_
- asp.net错误捕获(错误处理)page_error事件使用方法_实用技巧_
- asp.net错误处理Application_Error事件示例_实用技巧_
- 使用xenocode代码混淆加密的操作步骤_实用技巧_
- ASP.NET防止页面刷新的两种解决方法小结_实用技巧_
- asp.net webservice返回json的方法_实用技巧_
- asp.net后台弹窗如何实现_实用技巧_
- 获取根目录的URL例如http://localhost:51898_实用技巧_
- asp.net获取网站目录物理路径示例_实用技巧_
