views:

178

answers:

1

So m.SourceCollection has 1000 records going into this, which is a collection of items with a Lat and Lon property; nothing else. I run this:

var results = from locs in m.PlacesBeen
                      group locs by new {locs.Lat, locs.Lon }
                          into myGroup
                           select new { Lat = myGroup.Key.Lat, Lon = myGroup.Key.Lon };

The next breakpoint, "results" has three items in it. I'm just trying to do a group by and get the unique amounts out, much like I would in SQL.

+1  A: 

That query looks OK - what results were you expecting?

Btw, here's a simpler way to write the same query:

var results = 
  m.PlacesBeen.Select (loc => new {locs.Lat, locs.Lon }).Distinct();
Joe Albahari