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

.NET Framework (current version)
 

Gets or sets the heading in degrees, relative to true north.

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

public double Course { get; set; }

Property Value

Type: System.Double

The heading in degrees, relative to true north.

Exception Condition
ArgumentOutOfRangeException

Course is set outside the valid range.

The valid range includes values from 0.0 to 360.0, and Double.NaN if the heading is not defined.

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:
© 2016 Microsoft