我想验证纬度和经度。现在,我只检查该值是否不为空,但我希望进行验证以确保它是有效的纬度或经度。
我该如何做呢?
我的属性看起来像这样:
public string Lat
{
get {
return this._lat;
}
set
{
base.ValidationErrors.Remove("Lat");
if (String.IsNullOrWhiteSpace(value))
{
this.ValidationErrors.Add("Lat", strings.Positions_Lat_Empty);
}
this._lat = value != null ? value.Trim() : null;
}
}
public string Lng
{
get {
return this._lng;
}
set {
base.ValidationErrors.Remove("Lng");
if (String.IsNullOrWhiteSpace(value))
{
this.ValidationErrors.Add("Lng", strings.Positions_Lng_Empty);
}
this._lng = value != null ? value.Trim() : null;
}
}