Läs på engelska Redigera

Dela via


IPAddressInformation Class

Definition

Provides information about a network interface address.

C#
public abstract class IPAddressInformation
Inheritance
IPAddressInformation
Derived

Examples

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

C#
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)
        {
            Console.WriteLine(adapter.Description);
            foreach (IPAddress dns in dnsServers)
            {
                Console.WriteLine("  DNS Servers ............................. : {0}",
                    dns.ToString());
            }
            Console.WriteLine();
        }
    }
}

Remarks

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

Constructors

IPAddressInformation()

Initializes a new instance of the IPAddressInformation class.

Properties

Address

Gets the Internet Protocol (IP) address.

IsDnsEligible

Gets a Boolean value that indicates whether the Internet Protocol (IP) address is valid to appear in a Domain Name System (DNS) server database.

IsTransient

Gets a Boolean value that indicates whether the Internet Protocol (IP) address is transient (a cluster address).

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

Produkt Versioner
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1