0

我想创建一个包含包的数据库,每个包包含 50 个级别,每个级别都有二维整数数组和二维布尔数组的信息。

如何以可以轻松访问它们的方式存储所有这些数组?

我的应用程序正在从用户输入创建一个int[,]数组和一个bool[,]数组,我希望将这些数组保存在用户在用户选择的包上选择的级别上。

我想可能会为每个包制作数据表,其中包含一个列用于其包,列具有级别号(1-50)和 2 个字符串列,数组转换为长字符串,但它看起来太乱了..

DataTable Pack1= new DataTable();
Pack1.Columns.Add("level",typeof(int));
Pack1.Columns.Add("Pack",typeof(int));
Pack1.Columns.Add("intarr",typeof(string));
Pack1.Columns.Add("boolarr",typeof(string));
Pack1.Rows.Add(1,1,"1,2,0,1,2,0,2,3,0,-1,2,1,5,3,2,1",
"f,t,f,f,t,f,f,f,t,f,t,t,f,t,f,t");
Pack1.Rows.Add(2,1,"1,2,3,2,1,-1,2,3,1,4,2,3,1,5,-1,-1",
"t,f,f,f,t,f,t,t,f,f,t,t,f,t,f,f");

等等..我希望有一个更好的解决方案。

4

1 回答 1

0

Such data is not a good fit for storing in table form, because it has no relational or hierarchical structure. Store whole arrays as blobs, either in the database or in flat files.

于 2013-09-28T19:05:56.073 回答