DataTable消耗的内存比List< T> [英] Does a DataTable consume more memory than a List<T>?

查看:100
本文介绍了DataTable消耗的内存比List< T>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

是的,绝对是一个DataTable消耗的内存比List更多。



DataTable类有很多对象用于列定义,表信息(名称等),行对象的集合,项目数组(基本上都是列表)等等。



编辑:此外,列表更加有效地添加项目,迭代等(反映通用列表的添加代码,数据表可查看更多详细信息)。


Is there a trade off in respect to performance, trade off in respect to memory consumption?

解决方案

Yes, absolutely a DataTable consumes more memory than a List.

The DataTable class has lots of objects for column definitions, the table info (name, etc), collections of row objects, the "item arrays" for each row (which is basically all the List would have), etc.

EDIT: Also, List is more performant for adding items, itterating through, etc. (reflect the code for "Add" for generic lists, and for data tables to see more detail).

这篇关于DataTable消耗的内存比List< T>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆