Answer by Thebigcheeze for This code returns distinct values. However, what I...
Should be as simple as:var foo = (from data in pivotedData.AsEnumerable() select new { Group = data.Field<string>("Group_Number"), Study = data.Field<string>("Study_Name")...
View ArticleAnswer by James Michael Hare for This code returns distinct values. However,...
For Distinct() (and many other LINQ features) to work, the class being compared (BarObject in your example) must implement implement Equals() and GetHashCode(), or alternatively provide a separate...
View ArticleAnswer by Gage for This code returns distinct values. However, what I want is...
Either do as dlev suggested or use:var foo = (from data in pivotedData.AsEnumerable() select new BarObject { Group = data.Field<string>("Group_Number"), Study =...
View ArticleAnswer by bevacqua for This code returns distinct values. However, what I...
Try this:var foo = (from data in pivotedData.AsEnumerable().Distinct() select new BarObject { Group = data.Field<string>("Group_Number"), Study = data.Field<string>("Study_Name") });
View ArticleAnswer by Philip Daubmeier for This code returns distinct values. However,...
Looks like Distinct can not compare your BarObject objects. Therefore it compares their references, which of course are all different from each other, even if they have the same contents.So either you...
View ArticleAnswer by jason for This code returns distinct values. However, what I want...
You need to override Equals and GetHashCode for BarObject because the EqualityComparer.Default<BarObject> is reference equality unless you have provided overrides of Equals and GetHashCode (this...
View ArticleAnswer by i_am_jorf for This code returns distinct values. However, what I...
You want to use the other overload for Distinct() that takes a comparer. You can then implement your own IEqualityComparer<BarObject>.
View ArticleThis code returns distinct values. However, what I want is to return a...
I have the following code:var foo = (from data in pivotedData.AsEnumerable() select new { Group = data.Field<string>("Group_Number"), Study = data.Field<string>("Study_Name")...
View Article