GeoCoordinate.Speed Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the speed in meters per second.
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
Property Value
The speed in meters per second. The speed must be greater than or equal to zero, or NaN.
Exceptions
Speed is set outside the valid range.
Examples
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");
}
}
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
Applies to
Werk met ons samen op GitHub
De bron voor deze inhoud vindt u op GitHub, waar u ook problemen en pull-aanvragen kunt maken en bekijken. Raadpleeg onze gids voor inzenders voor meer informatie.
Feedback
https://aka.ms/ContentUserFeedback.
Binnenkort: Gedurende 2024 worden GitHub Issues uitgefaseerd als het feedbackmechanisme voor inhoud. Dit wordt vervangen door een nieuw feedbacksysteem. Ga voor meer informatie naar:Feedback verzenden en bekijken voor