开发者

DataTable type of array binding in cf.net

I would like to make a (very lightweight) 2-way binding datastore. Values must be accessed via names. I was thinking of using 2 arrays:

public class MyBindingDatastore{
    public string[] _names = new string[]{"Field1", "Field2", "Field3"}
    public object[] _values = new object[]{ DateTime.Now, "MyValue", 1}
}

First array is used to store field names(always 1 row). Second array( can be also 2D if more than 1 record) represent value matrix. Using GUI widget(Resco detailview or any that support 2-way databinding), I would like to specify:

MyControl.DataMember = "Field1";
MyControl.DataSource = new MyBindingDatastore();

Result of databinding should be properly displayed value from the value array. After a value inside GUI widget is changed, a change must occour in a datastore(value array) too.开发者_高级运维

Any idea on how to implement that? Or, is it better to use more bloated DataTable class to mimic datatable binding (I believe that DataTable has a lot overhead against array)?


If you're wanting to use DataBinding you should probably stick with the DataTable. Otherwise you will have to implement your own databinding anyway. If memory size is your concern, look for ways to minimize the amount of data loaded to memory at one time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜