List是否优于使用.net的Dataset / DataTable对象? [英] Is List is better than Dataset /DataTable object using .net?

查看:97
本文介绍了List是否优于使用.net的Dataset / DataTable对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们应该使用List<>对象以及何时应该使用数据集/数据表对象从数据库中获取超过10000行。

When we should use the List<> object and when we should use the Dataset/Datatable object for fetching more than 10000 rows from database.

推荐答案

如果您不关心如何获取数据使用dataadapter / datareader但想知道哪个数据源集合对你有帮助。你必须首先考虑一下你将如何处理你的数据。

数据表和数据集是好的,但是很重要的集合与列表,数组,字典等其他集合相比但非常有用(它们有内置许多功能,如排序,过滤器,父子关系等等。由于它们的基础是XML,因此它们是任何支持xml的系统的最便携式集合。 WCF,Web服务在没有太多帮助的情况下轻松吸收它们。

现在,如果您不想要上述功能。列表,数组是更好的选择。但仍然有很多优化和性能的秘密。

如果想知道这些集合的真正区别,请点击此链接 http://www.dotnetperls.com/collections [ .Net Collection ]。



http:// www.dotnetperls.com/optimization [ .Net Optimization ]



如果您喜欢这个解决方案,请接受答案。
if u don''t care about how you are fetching data using dataadapter/ datareader but wants to know which data source collection will be helpful to u. U have to 1st think about what are u going to do with your data.
Datatable and dataset are good but heavy collection compare to other collections like list,array,dictionary etc. but Very useful (they have built-in many functionality like sort,filter, parent - child relation and many more). As their base is XML they are most portable collection with any system which support xml. WCF,web service absorb them easily without much help.
Now if you don''t want above functionality. List ,array are better option.But still there is lot of secrets of optimization and performance.
If want to know real difference of such collections , follow this link http://www.dotnetperls.com/collections[.Net Collection].

http://www.dotnetperls.com/optimization[.Net Optimization]

If u like this solution ,plz accept as answer.


您可能想要比较 DataSet vs DataReader 性能(因为,为了填充你的列表,你需要以某种方式访问​​数据库)。

在这里你有一个很好的参考:性能比较ison:数据访问技术 [ ^ ]。
You probably meant to compare DataSet vs DataReader performance (because, in order to populate your list you need to somehow access the database).
Here you have a good reference: "Performance Comparison: Data Access Techniques"[^].


如果要从数据库中获取数据,则可能会抓取多列数据。在这种情况下,您应该使用 DataSet [ ^ ]和 DataTable [ ^ ],它处理数据的列和行。< br $> b $ b

列表 [ ^ ]就像数组一样,它们是一个集合。如果你有一个简单的一列数据列表,你就会使用它们。
If you are fetching data from a database, you are likely grabbing more than one column of data. In that case, you should use a DataSet[^] and DataTable[^], which handle both columns and rows of data.

Lists[^] are like arrays in that they are a single collection. You''d use them if you had a simple one column list of data.


这篇关于List是否优于使用.net的Dataset / DataTable对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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