GeoCoordinate.Speed プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
毎秒メートル単位の速度を取得または設定します。
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
プロパティ値
毎秒メートル単位の速度。 速度は、ゼロ以上の値または NaN である必要があります。
例外
Speed が、有効範囲外の値に設定されています。
例
次の例では、現在のCourse場所GeoCoordinateの の プロパティと Speed プロパティを出力します。
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
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET