0

各カテゴリで最も近い場所を取得しようとしています。誰でも私がこれを行うのを手伝ってもらえますか?

var xml = new XElement("Locations", 
                    locations.OrderBy(n => n.CategoryID)
                        .ThenBy(n => distance(lat, lon, (double)n.Latitude, (double)n.Longitude))
                        .Where(n => (distance(lat, lon, (double)n.Latitude, (double)n.Longitude) <= 5))
                        .Select(location => 
                        new XElement("Location",
                            new XAttribute("CategoryID", location.CategoryID),
                            new XElement("Category", location.Category),
                            new XElement("LocationID", location.LocationID),
                            new XElement("LocationName", location.LocationName),
                            new XElement("Latitude", location.Latitude),
                            new XElement("Longitude", location.Longitude),
                            new XElement("Distance", distance(lat, lon, (double)location.Latitude, (double)location.Longitude)),
                            new XElement("Status", (location.HasManagedHours ? "Managed Hours" : "Open"))
                            )));
4

1 に答える 1