C# 建议此网格的数据结构?

C# 建议此网格的数据结构?,c#,mono,unity3d,C#,Mono,Unity3d,假设您有一个3X3网格,它是从任何一个9x9网格中获取值而形成的。我想在创建这个新的3X3网格时,保存从哪个9X9网格消耗了哪些值的信息 因为使用值类型作为字典键是有问题的,正如xamarin文档中所写的那样。所以我用的是SortedList,它很有效,但我想听听你的意见,最好的方法是什么。我应该用tupple吗 SortedList<int, SortedList<int, SortedList<int, int>>> foo = new Sorte

假设您有一个3X3网格,它是从任何一个9x9网格中获取值而形成的。我想在创建这个新的3X3网格时,保存从哪个9X9网格消耗了哪些值的信息

因为使用值类型作为字典键是有问题的,正如xamarin文档中所写的那样。所以我用的是SortedList,它很有效,但我想听听你的意见,最好的方法是什么。我应该用tupple吗

SortedList<int, SortedList<int, SortedList<int, int>>> foo =
    new SortedList<int, SortedList<int, SortedList<int, int>>>(); 

int grid = 0;
int row = 0;
int column = 0;
int val = 0;

if(!foo.ContainsKey(grid))
 foo.Add(grid,new SortedList<int,SortedList<int, int>>());

if (!foo[grid].ContainsKey(row))
 foo[grid].Add(row, new SortedList<int, int>());

if(!foo[grid][row].ContainsKey(column))
 foo[grid][row].Add(column,val);
SortedList foo=
新分类列表();
int grid=0;
int行=0;
int列=0;
int-val=0;
如果(!foo.ContainsKey(网格))
添加(网格,新的分类列表());
如果(!foo[grid].ContainsKey(行))
foo[grid].Add(行,new SortedList());
如果(!foo[grid][row].ContainsKey(column))
foo[grid][row].Add(列,val);

如果您确切地知道它将有多大,为什么不使用阵列呢?我想保存信息,说明在制作这个新的3X3网格时,两个9X9网格中的哪些点已被消耗。因此,我可以使用这2个9X9网格中留下的点来创建更独特的3X3网格。我指的是这个网格上的一个框。为什么不为数据创建一个类呢?然后给每个属性指定一个有意义的名称。如果您使用元组,您必须记住每个元素代表什么。“Xamarin”:monotouch、mono、monomac等。?