如何将绑定源转换为字典或数组或列表 [英] how to convert binding source to dictionary or array or list

查看:65
本文介绍了如何将绑定源转换为字典或数组或列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将数据从绑定源分配到Dictionary或Array或List

当我这样使用时出现错误

how to assign data from binding source to Dictionary or Array or List
I got error when I use like this

var lists = (Display[])gridDisplay.DataSource;
Display[] arr = lists.ToArray();

推荐答案

如果您绑定项目如下

if you bind items as below
List<display> DisplayItems =//get items;
gridDisplay.DataSource =DisplayItems;



然后你可以像下面那样取回


then you can get it back like below

List<display> result= (List<display>)gridDisplay.DataSource;


这篇关于如何将绑定源转换为字典或数组或列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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