遍历list<T>
来源:互联网 发布:观察者手机间谍软件 编辑:程序博客网 时间:2024/05/17 03:15
public static void ListGenericType(object list)
{
Type objType = list.GetType();
int count = (int)(objType.GetProperty("Count").GetValue(list, null));
for (int i = 0; i < count; i++)
{
object listItem = objType.GetProperty("Item").GetValue(list, new object[] { i });
foreach (PropertyInfo propertyInfo in listItem.GetType().GetProperties())
{
object value = propertyInfo.GetValue(listItem, null);
Console.WriteLine(propertyInfo.Name+"="+value);
}
}
}
{
Type objType = list.GetType();
int count = (int)(objType.GetProperty("Count").GetValue(list, null));
for (int i = 0; i < count; i++)
{
object listItem = objType.GetProperty("Item").GetValue(list, new object[] { i });
foreach (PropertyInfo propertyInfo in listItem.GetType().GetProperties())
{
object value = propertyInfo.GetValue(listItem, null);
Console.WriteLine(propertyInfo.Name+"="+value);
}
}
}
0 0
- 遍历list<T>
- 单链表与List<T>究竟哪个遍历速度快?
- Map在jsp页面中的遍历(Map<String, List<T>>)
- List<T>
- List遍历
- list遍历
- list遍历
- List遍历
- 遍历List<T>包含字典Dictionary和其他字段dataGridView绑定数据
- MVC4使用微软企业库 dataset foreach遍历 转换成list<T>
- javawebday11(junit debug调试 泛型 遍历 list set map 使用通配符T)
- <T> List<T>的用法
- List<T>和List<Object[]>
- list<?>与list<T>区别
- List( T ) 类
- DataReader To List<T>
- C# List<T>用法
- List<T>用法
- qt+opencv开发海康威视网络摄像机采集处理程序
- 《大数据时代》读书笔记
- openStream打开网络地址获取文件流
- Tomcat9配置HTTP2
- [快速学会Swift第三方库]AlamofireObjectMapper
- 遍历list<T>
- log4j JDBCAppender 消息中有单引号 BUG
- java中正则表达式的使用(1)
- 如何下载spring框架开发包
- struts2在struts.xml中为返回的页面配参数时出现Invalid result location value/parameter
- union和union all的使用
- 自动获取客户登陆信息(Python)
- jquery的代码封装
- 一种通用的SingleNumber问题解法