GeoCoordinate.Speed Eigenschap

Definitie

Hiermee haalt of stelt u de snelheid in meters per seconde in.

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

Waarde van eigenschap

De snelheid in meters per seconde. De snelheid moet groter dan of gelijk zijn aan nul, of NaN.

Uitzonderingen

Speed is ingesteld buiten het geldige bereik.

Voorbeelden

In het volgende voorbeeld worden de Course en Speed eigenschappen van de huidige locatie GeoCoordinateafgedrukt.

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

Van toepassing op