通用转换列表数据集在C#

编程入门 行业动态 更新时间:2024-10-18 03:23:12
本文介绍了通用转换列表数据集在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有对象的泛型列表。每个对象都有9字符串属性。我希望把这个列表变成数据集,我可以传递到一个DataGridView ......最新最好的方式去这样做呢?

I have a Generic list of Objects. Each object has 9 string properties. I want to turn that list into a dataset that i can pass to a datagridview......Whats the best way to go about doing this?

推荐答案

你试过列表绑定,直接在DataGridView?如果没有,尝试,首先因为这将节省您大量的痛苦。如果你已经尝试过了,请告诉我们什么地方出了错,所以我们可以更好地提供建议。数据绑定为您提供了不同的行为取决于什么接口的数据对象实现。例如,如果你的数据对象只实现的IEnumerable (如列表),你会得到非常基本的单向绑定,但如果它实现 IBindingList的以及(如的BindingList ,数据视图),那么你得到双向绑定。

Have you tried binding the list to the datagridview directly? If not, try that first because it will save you lots of pain. If you have tried it already, please tell us what went wrong so we can better advise you. Data binding gives you different behaviour depending on what interfaces your data object implements. For example, if your data object only implements IEnumerable (e.g. List), you will get very basic one-way binding, but if it implements IBindingList as well (e.g. BindingList, DataView), then you get two-way binding.

更多推荐

通用转换列表数据集在C#

本文发布于:2023-11-13 14:52:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584628.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据   列表

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!