IPInterfaceProperties.IsDnsEnabled 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 Boolean 值,指出是否已將 NetBt 為使用 DNS 名稱解析。
public:
abstract property bool IsDnsEnabled { bool get(); };
public abstract bool IsDnsEnabled { get; }
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("freebsd")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("osx")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public abstract bool IsDnsEnabled { get; }
member this.IsDnsEnabled : bool
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("freebsd")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("osx")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
member this.IsDnsEnabled : bool
Public MustOverride ReadOnly Property IsDnsEnabled As Boolean
屬性值
如果這個介面上的 NetBt 設定為使用 DNS 名稱解析則為 true
,否則為 false
。
- 屬性
範例
下列程式代碼範例會顯示此屬性的值。
void DisplayDnsConfiguration()
{
array<NetworkInterface^>^adapters = NetworkInterface::GetAllNetworkInterfaces();
System::Collections::IEnumerator^ myEnum10 = adapters->GetEnumerator();
while ( myEnum10->MoveNext() )
{
NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum10->Current);
IPInterfaceProperties ^ properties = adapter->GetIPProperties();
Console::WriteLine( adapter->Description );
Console::WriteLine( " DNS suffix................................. :{0}",
properties->DnsSuffix );
Console::WriteLine( " DNS enabled ............................. : {0}",
properties->IsDnsEnabled );
Console::WriteLine( " Dynamically configured DNS .............. : {0}",
properties->IsDynamicDnsEnabled );
}
}
public static void DisplayDnsConfiguration()
{
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in adapters)
{
IPInterfaceProperties properties = adapter.GetIPProperties();
Console.WriteLine(adapter.Description);
Console.WriteLine(" DNS suffix .............................. : {0}",
properties.DnsSuffix);
Console.WriteLine(" DNS enabled ............................. : {0}",
properties.IsDnsEnabled);
Console.WriteLine(" Dynamically configured DNS .............. : {0}",
properties.IsDynamicDnsEnabled);
}
Console.WriteLine();
}
Public Shared Sub DisplayDnsConfiguration()
Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Dim adapter As NetworkInterface
For Each adapter In adapters
Dim properties As IPInterfaceProperties = adapter.GetIPProperties()
Console.WriteLine(adapter.Description)
Console.WriteLine(" DNS suffix................................. :{0}", properties.DnsSuffix)
Console.WriteLine(" DNS enabled ............................. : {0}", properties.IsDnsEnabled)
Console.WriteLine(" Dynamically configured DNS .............. : {0}", properties.IsDynamicDnsEnabled)
Next adapter
End Sub
備註
DNS 是階層式命名系統,用來將主機名對應至IP位址。