This documentation is archived and is not being maintained.

IPAddressInformation Class

Provides information about a network interface address.

Namespace:  System.Net.NetworkInformation
Assembly:  System (in System.dll)

public abstract class IPAddressInformation

You do not create instances of this class; instances are returned by methods in the IPInterfaceProperties class.

The following code example displays the Domain Name Service (DNS) addresses for the network interfaces on the local computer.

public static void DisplayDnsAddresses()
    NetworkInterface[] adapters  = NetworkInterface.GetAllNetworkInterfaces();
    foreach (NetworkInterface adapter in adapters)

        IPInterfaceProperties adapterProperties = adapter.GetIPProperties();
        IPAddressCollection dnsServers = adapterProperties.DnsAddresses;
        if (dnsServers.Count > 0)
            foreach (IPAddress dns in dnsServers)
                Console.WriteLine("  DNS Servers ............................. : {0}", 
void DisplayDnsAddresses()
    NetworkInterface* adapters[]  = NetworkInterface::GetAllNetworkInterfaces();
    System::Collections::IEnumerator* myEnum11 = adapters->GetEnumerator();
    while (myEnum11->MoveNext())
        NetworkInterface* adapter = __try_cast<NetworkInterface*>(myEnum11->Current);

        IPInterfaceProperties* adapterProperties = adapter->GetIPInterfaceProperties();
        IPAddressInformationCollection* dnsServers = adapterProperties->DnsAddresses;
        if (dnsServers->Count > 0)
            System::Collections::IEnumerator* myEnum12 = dnsServers->GetEnumerator();
            while (myEnum12->MoveNext())
                IPAddressInformation* dns = __try_cast<IPAddressInformation*>(myEnum12->Current);
                Console::WriteLine(S"  DNS Servers ............................. : {0} ({1} {2})", 
                    dns->IsTransient ? S"Transient" : S"", 
                    dns->IsDnsEligible ? S"DNS Eligible" : S""

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0