Nullable Altitude

Feb 23, 2012 at 4:07 PM

Your current ILocation interface has no possibility to set the altitude to "unknown". I suggest to use a nullable type instead. double? seems to fit here.

  public interface ILocation
  {
    double Latitude { get; set; }
    double Longitude { get; set; }
    double Altitude { get; set; }
  }

  public interface ILocation
  {
    double Latitude { get; set; }
    double Longitude { get; set; }
    double? Altitude { get; set; }
  }

What do you think? Any other ways to set the altitude to an unknown value? Some suggests to set the height value
to a very high or very low value to mark the altitude as invalid (e.g. set it to -1000000 or 1000000) but I think a nullable
type would show the intend of setting it to unknown value is a cleaner way.

 

Coordinator
Feb 27, 2012 at 3:23 AM

A nullable type looks like an excellent choice - I'll make the change and see if anything breaks.