什么应该是正确的数据结构来存储表格格式数据。 [英] What should be correct data structure to store tabular format data.

查看:335
本文介绍了什么应该是正确的数据结构来存储表格格式数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的数据如下:

List< obj> = {

obj1 prop1,

obj2 prop1,

obj3 prop1,



obj1 prop2,

obj2 prop2,



obj2 prop3,

obj3 prop3,



obj1 prop4,

obj2 prop4,}



但在UI中我必须显示在上面像这样:



prop1 obj1 obj2 obj3

prop2 obj1 obj2 -

prop3 - obj2 obj3

prop4 obj1 - obj3



短行数取决于属性数量和属性数量的列数。

我试图使用Dictionary。但它并不符合我的所有情况。



提前谢谢。

解决方案

AS Richard建议,包含属性的类是一个非常好的方法,我采取的路线。

另一个建议是使用 DataTable [ ^ ] - 表格数据正是它们的设计......

Hi All,
I have data like below:
List<obj> = {
obj1 prop1,
obj2 prop1,
obj3 prop1,

obj1 prop2,
obj2 prop2,

obj2 prop3,
obj3 prop3,

obj1 prop4,
obj2 prop4,}

But in UI I have to display above like this :

prop1 obj1 obj2 obj3
prop2 obj1 obj2 -
prop3 - obj2 obj3
prop4 obj1 - obj3

In short number of rows will be dependent on number of properties and number of columns on number of properties.
I tried to use Dictionary. But it does not fulfill my all scenarios.

Thanks in advance.

解决方案

AS Richard suggests, a class to contain the properties is a very good way to go, and teh route I'd take.
The other suggestion would be to use a DataTable[^] - tabular data is exactly what they were designed for...


这篇关于什么应该是正确的数据结构来存储表格格式数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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