Validate latitude and longitude

后端 未结 4 1339
鱼传尺愫
鱼传尺愫 2021-02-01 03:04

I want to validate the latitude and longitude. Right now, I check just so that the value is not empty, but I want a validation to check that it is a valid latidue or longitude.<

4条回答
  •  礼貌的吻别
    2021-02-01 03:06

    Alternatively you can use GeoCoordinate class that is built into .NET 4 (reference System.Device.dll). Its constructor throws on invalid longitude and latitude:

    latitude

    Type: System.Double

    The latitude of the location. May range from -90.0 to 90.0.

    longitude

    Type: System.Double

    The longitude of the location. May range from -180.0 to 180.0.

提交回复
热议问题