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
Asked
Active
Viewed 115 times
1

Arun Prasad E S
- 9,489
- 8
- 74
- 87
-
2Are you sure that it's really repeated and not in different case or with extra space? – Alex Riabov Jul 08 '18 at 16:14
1 Answers
2
Sorry guys, it was linqToExcel specific issue
var CategoryList = ItemList.Select(x => x.CategoryName.Value).Distinct().ToList();
value column was needed to fix it

Arun Prasad E S
- 9,489
- 8
- 74
- 87