GeoCoordinate.Course プロパティ

定義

真北を基準にして、度単位で見出しを取得または設定します。

public:
 property double Course { double get(); void set(double value); };
public double Course { get; set; }
member this.Course : double with get, set
Public Property Course As Double

プロパティ値

真北を基準にした度単位の見出し。

例外

Course が有効な範囲外に設定されています。

次の例では、現在の場所のCourseSpeedプロパティとGeoCoordinate プロパティを出力します。

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

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

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

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

Public Sub GetLocationCourseAndSpeed()
    Dim watcher As GeoCoordinateWatcher
    watcher = New System.Device.Location.GeoCoordinateWatcher()
    watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))

    If Not watcher.Position.Location.IsUnknown Then
        Dim coord As GeoCoordinate = watcher.Position.Location
        Console.WriteLine("Course: {0}, Speed: {1}",
            coord.Course,
            coord.Speed) 'NaN if not available.
    Else
        Console.WriteLine("Location unknown.")
    End If

End Sub

注釈

有効な範囲には、0.0 から 360.0 までの値が含まれており、見出しが定義されていない場合は Double.NaN

適用対象