鉴于以下法典,我如何将物体价值清单与测试价值进行比较?
I m 建造一个地段应用。 我的病情是经过大度和自由度的,希望得到最接近这些价值观的地点的服务答案。
我开始走上将价值观转化成一种扼杀和化的道路,将价值分成两处,但这似乎是一个太小的贫民窟,我渴望找到一个更加棘手的解决办法。
public class Location : IEnumerable
{
public string label { get; set; }
public double lat { get; set; }
public double lon { get; set; }
//Implement IEnumerable
public IEnumerator GetEnumerator()
{
return (IEnumerator)this;
}
}
[HandleError]
public class HomeController : Controller
{
private List<Location> myList = new List<Location>
{
new Location {
label="Atlanta Midtown",
lon=33.657674,
lat=-84.423130},
new Location {
label="Atlanta Airport",
lon=33.794151,
lat=-84.387228},
new Location {
label="Stamford, CT",
lon=41.053758,
lat=-73.530979}, ...
}
public static int Main(String[] args)
{
string inLat = "-80.987654";
double dblInLat = double.Parse(inLat);
// here s where I would like to find the closest location to the inLat
// once I figure out this, I ll implement the Longitude, and I ll be set
}