语言

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 包含此接口的 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”。

适用于