.net中字典的使用
来源:互联网 发布:图书馆借阅系统 源码 编辑:程序博客网 时间:2024/06/05 10:57
(1)循环遍历字典中的元素:
List<IDictionary<object, object>> items = (List<IDictionary<object, object>>)dictItems.Values[i_page];
if (items != null && items.Count > 0)
{
for (int k = 0; k < items.Count; k++)
{
IDictionary<object, object> item = (IDictionary<object, object>)items[k];
string url = "";
string pic = "";
foreach (KeyValuePair<object, object> kvp in item)
{
if (kvp.Key.ToString().ToLower().Contains("url"))
{
url = kvp.Value.ToString();
}
if (kvp.Key.ToString().ToLower().Contains("pic"))
{
pic = kvp.Value.ToString();
}
}
}
}
(2)给字典添加元素:
List<IDictionary<object, object>> items = null;
Dictionary<object, object> item = new Dictionary<object, object>();
item["Url"] = dr["url"].ToString();
item["Pic"] =dr["pic"].ToString();
items.Add(item);
阅读全文
0 0
- .net中字典的使用
- C#中字典的使用
- C#中字典的使用Dictionary
- AS3中字典Dictionary的使用 .
- C#中字典的使用Dictionary
- Objective-C中字典的使用
- asp中Dictionary(数据字典)的使用
- swift中dictionary字典的使用
- swift中dictionary字典的使用
- Python中字典get方法的使用
- 命令行中使用字典
- OC中字典的使用,数组的使用----省市区
- (工作中)springmvc的对字典表的使用@dict
- 数据库-字典的使用
- 字典树的使用
- Swift字典的使用
- 字典的使用
- NSDictionary字典的使用
- Python3简单教程(四)迭代器与生成器
- ubuntu 常用命令:[1]ps 查看所有运行程序
- java基本类型数据所占字节数
- 探索 Linux 内存模型
- iOS资源的加载
- .net中字典的使用
- jmap命令(Java Memory Map)
- getX getRawX的区别
- html小积累
- hdoj1073 Online Judge(对字符串的操作问题)
- POI使用详解
- 二叉搜索树的后序遍历序列(java版)
- 面试经验之谈
- android获取设备屏幕大小的方法