GeoCoordinate.Unknown 필드

정의

알 수 없는 위도 및 경도 필드가 있는 GeoCoordinate 개체를 나타냅니다.

public: static initonly System::Device::Location::GeoCoordinate ^ Unknown;
public static readonly System.Device.Location.GeoCoordinate Unknown;
 staticval mutable Unknown : System.Device.Location.GeoCoordinate
Public Shared ReadOnly Unknown As GeoCoordinate 

필드 값

예제

다음 코드 예제에서는 위치에 Unknown 해당하는 가 위도 및 경도를 인쇄하기 전에 인지 확인 GeoCoordinate 합니다.

using System;
using System.Device.Location;

namespace GetLocationPropertyHandleUnknown
{
    class Program
    {
        static void Main(string[] args)
        {
            GetLocationPropertyHandleUnknown();
        }

        static void GetLocationPropertyHandleUnknown()
        {
            GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
            watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));

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

                Console.WriteLine("Lat: {0}, Long: {1}",
                    coord.Latitude,
                    coord.Longitude);
            }
            else
            {
                Console.WriteLine("Unknown");
            }
        }
    }
}
Imports System.Device.Location

Module GetLocationProperty
    Public Sub GetLocationPropertyHandleUnknown()
        Dim watcher As New System.Device.Location.GeoCoordinateWatcher()
        watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))
        If watcher.Position.Location.IsUnknown <> True Then
            Dim coord As GeoCoordinate = watcher.Position.Location
            Console.WriteLine("Lat: {0}, Long: {1}", coord.Latitude, coord.Longitude)
        Else
            Console.WriteLine("Unknown latitude and longitude.")
        End If
    End Sub

    Public Sub Main()
        GetLocationPropertyHandleUnknown()
        Console.ReadLine()
    End Sub

End Module

설명

속성을 IsUnknown 사용하여 에 데이터가 포함되어 있지 않은지 여부를 GeoCoordinate 확인할 수 있습니다.

적용 대상