开发者

C# table rows and columns

What object can I use that has rows and columns, but not DataTable as it looks 开发者_JAVA技巧like an Excel Table?


I would use BindingList<T> or List<T>. BindingList would get my vote, as it is essentially a List with some extra options that enable it to be bound to a datagridview or Listbox very easily. And it is more light-weight than a DataTable.

Your rows will be each item in the list, and your columns will be the properties of each object that you bind to your viewer, such as a datagridview. I used this recently with a BindingList and it went very well.


Ultimately your options are these:

  1. Multidimensional array: a[i,j] = value
  2. Jagged array: a[i][j] = value
  3. Indexed array: a[i+N*j] = value

Most other classes that I can think of, wrap one of these types of arrays.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜