Quantcast
Channel: This code returns distinct values. However, what I want is to return a strongly typed collection as opposed to an anonymous type - Stack Overflow
Browsing all 8 articles
Browse latest View live

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 Article



Answer 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 Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

This 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

Browsing all 8 articles
Browse latest View live




Latest Images