我是新来的,对C#没有什么经验。我一直在搜索MSDN文档和谷歌,但无法找到答案(我尽量一般说尽可能):.NET C# - 阵列中不同阵列的数量
我想存储一个固定长度的有序序列的整数一个列表或数组,然后创建这些整数数组的数组。有谁知道我可以如何计算不同的整数数组的数量,以及我应该使用哪些特定的数据类型(列表,普通数组等)?我没有我一直在与确切的代码,但这里的相似,我一直在努力的东西:
int[] set1 = {2, 56, 8};
int[] set2 = {8, 25, 90};
int[] set3 = {2, 56, 8};
var superset = new List<int[]>;
superset.Add(set1);
superset.Add(set2);
superset.Add(set3);
Console.Out.WriteLine(superset.Distinct().Count()); // would like this to output 2, but Distinct() doesn't seem to actually work and I would get 3
你绝对需要使用整数数组吗?如果将固定长度的数组定制到自定义对象中,那么只需在该自定义类上实现'IEquatable(T)'并且'.Distinct()'将本地比较它。 – David 2012-01-04 20:05:28
+1用于思考相同的方向。如果我们知道确切的问题是什么,这可能会容易得多。 – 2012-01-04 20:08:45