GeoCoordinate.Speed Eigenschaft

Definition

Ruft die Geschwindigkeit in Meter pro Sekunde ab oder legt sie fest.

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

Eigenschaftswert

Die Geschwindigkeit in Meter pro Sekunde. Die Geschwindigkeit muss größer als oder gleich 0 (null) sein, oder NaN.

Ausnahmen

Speed liegt außerhalb des gültigen Bereichs.

Beispiele

Im folgenden Beispiel werden die Course Eigenschaften und Speed der -Eigenschaft des aktuellen Speicherorts GeoCoordinateausgegeben.

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");
    }
}

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

Gilt für: