GeoCoordinate.Unknown Field

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Represents a GeoCoordinate object that has unknown latitude and longitude fields.

Namespace:   System.Device.Location
Assembly:  System.Device (in System.Device.dll)

Public Shared ReadOnly Unknown As GeoCoordinate

The IsUnknown property can be used to verify whether a GeoCoordinate contains no data.

The following code example verifies whether the GeoCoordinate that corresponds to a location is Unknown before printingout its latitude and longitude.

Imports System.Device.Location
Module GetLocationProperty
    Public Sub GetLocationPropertyHandleUnknown()
        Dim watcher As New System.Device.Location.GeoCoordinateWatcher()
        watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))
        If watcher.Position.Location.IsUnknown <> True Then
            Dim coord As GeoCoordinate = watcher.Position.Location
            Console.WriteLine("Lat: {0}, Long: {1}", coord.Latitude, coord.Longitude)
        Else
            Console.WriteLine("Unknown latitude and longitude.")
        End If
    End Sub

    Public Sub Main()
        GetLocationPropertyHandleUnknown()
        Console.ReadLine()
    End Sub

End Module

.NET Framework
Available since 4.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: