Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

GeoCoordinate.Speed Property

.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.

Gets or sets the speed in meters per second.

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

public double Speed { get; set; }

Property Value

Type: System.Double

The speed in meters per second. The speed must be greater than or equal to zero, or NaN.

Exception Condition
System.ArgumentOutOfRangeException

Speed is set outside the valid range.

The following example prints the Course and Speed properties of the current location's GeoCoordinate.

static void GetLocationCourseAndSpeed()
{
    GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();

    watcher.TryStart(true, TimeSpan.FromMilliseconds(1000));

    if (watcher.Position.Location.IsUnknown != true)
    {
        GeoCoordinate coord = watcher.Position.Location;

        Console.WriteLine("Course: {0}, Speed: {1}",
            coord.Course,
            coord.Speed);
    }
    else
    {
        Console.WriteLine("Unknown");
    }
}

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