IPInterfaceProperties.DnsSuffix 属性

定义

获取与此接口关联的域名系统 (DNS) 后缀。

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

属性值

包含此接口的 DNS 后缀的 String,如果此接口没有 DNS 后缀,则为 Empty

属性

示例

下面的代码示例显示 DNS 后缀。

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 后缀标识域名 (例如,“contoso.com”) 追加到非限定主机名,以获取完全限定的域名 (FQDN) 适合 DNS 名称查询。 例如,如果本地计算机将“contoso.com”作为其 DnsSuffix,并且必须解析非限定的主机名“www”,则要查询的 FQDN 为“www.contoso.com”。

适用于