New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

No Title

86 Views
Copy Code Show/Hide Line Numbers
private readonly SortedList<Distance, List<BearingPoint>> pointsByX;
private readonly SortedList<Distance, List<BearingPoint>> pointsByY;
 
 
...
 
Point targetPoint;
var bestMatch = 
   (from pt in 
    (from kvp in pointsByX
     where kvp.Key > minX && kvp.Key < maxX
     select kvp.Value).Union(
     from kvp in pointsByY
     where kvp.Key > minY && kvp.Key < maxY
     select kvp.Value).Distinct()
    order pt by pt.Value.DistanceTo(targetPoint)
    select pt.Value).FirstOrDefault();
by mikecvelide
  September 28, 2009 @ 11:34am
Tags:
Comment:
ta da

Add a comment


Report Abuse
brought to you by:
West Wind Techologies


If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate