語言

IPInterfaceProperties.DnsSuffix 屬性

定義

此介面會獲得與此介面相關的網域名稱系統(DNS)後綴。

public:
 abstract property System::String ^ DnsSuffix { System::String ^ get(); };
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract string DnsSuffix { get; }
public abstract string DnsSuffix { get; }
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
member this.DnsSuffix : string
member this.DnsSuffix : string
Public MustOverride ReadOnly Property DnsSuffix As String

屬性值

String A 包含此介面的 DNS 後綴,或者Empty如果介面沒有 DNS 後綴。

屬性

範例

以下程式碼範例顯示 DNS 後綴。

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 後綴用以識別附加在未限定主機名稱上的網域名稱(例如「contoso.com」),以取得適合 DNS 名稱查詢的完全限定網域名稱(FQDN)。 例如,若本地機器的 「contoso.com」為其 DnsSuffix,且必須解析未限定的主機名稱「www」,則查詢的 FQDN 為「www.contoso.com」。

適用於