日期:2014-05-18  浏览次数:20680 次

关于:剔除重复元素,错在哪呢?
C# code
List<int> num = new List<int>() { 2, 9, 9, 2, 3, 9 };

num.distinct();

foreach (int item in num)
                {
                    for (int i = 0; i < num.Distinct().Count(); i++)
                    {
                        if (f.List.Cell(1, 1).Text.Length < sj.Distinct().Count())
                        {
                            f.List.Cell(1, 1).Text = f.List.Cell(1, 1).Text + sj[i].ToString();
                        }
                    }
                }



希望得到的结果是 239

------解决方案--------------------
List<int> num = new List<int>() { 2, 9, 9, 2, 3, 9 };

num = num.Distinct().ToList();


------解决方案--------------------
看了又看,LZ需要的是这个吧
C# code
f.List.Cell(1, 1).Text = string.Join("", num.Distinct().ToArray());

------解决方案--------------------
探讨

引用:
C# code
List<int> num = new List<int>() { 2, 9, 9, 2, 3, 9 };

num.distinct();

foreach (int item in num)
{
for (int i = 0; i < num.Distinct().Count(); i++)
……

NET 哪个版本???Dist……