gpt4 book ai didi

c# - c# 中的可绑定(bind)对象?

转载 作者:行者123 更新时间:2023-11-30 17:11:12 25 4
gpt4 key购买 nike

是什么让一个对象在 .net 中是可绑定(bind)的?

有人回答我说是 Ienumerable 类使它可绑定(bind)。

但是,当我查看 DataTAble (System.Data) 时,它并没有实现 Ienumerable:

public class DataTable : MarshalByValueComponent, 
IListSource,
ISupportInitializeNotification,
ISupportInitialize,
ISerializable,
IXmlSerializable
{...}

而且,我们仍然可以写:

myObj.DataSource=myDataTable;
myObj.Bind();

帮助?

最佳答案

DataTable 通过提供 DataTable.DefaultView 实现 IListSource

DataView 实现了绑定(bind)目标实际使用的 IBindingList

关于c# - c# 中的可绑定(bind)对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11499462/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com