C#LinqToExcel,显示所有结果的唯一结果-尝试过的在线解决方案无法解决

时间:2018-07-08 16:10:13

标签: c# linq linq-to-excel

  var ItemMaster = new ExcelQueryFactory("E:\\Group Item Master.xlsx");

        var ItemList = (from x in ItemMaster.Worksheet()
                        select new
                        {
                            CategoryName = x["CategoryName"],
                            GroupName = x["GroupName"],
                            ModelNo = x["ModelNo"],
                            Description = x["Description"],
                            Code = x["Code"]
                        }).ToList();


        var DistinctCategory = ItemList.Select(x => x.CategoryName).ToArray().Distinct();
        //shows categoryname repeated


        var iteml = ItemList.GroupBy(x => x.CategoryName);
        var DistinctCategoryTwo = iteml.Select(x => x.First()).ToList();
        //shows categoryname repeated

1 个答案:

答案 0 :(得分:2)

对不起,这是linqToExcel特有的问题

A-PR-UWY-Z
需要

值列进行修复