IP Adresse ermitteln(C#/CSharp)

Dieses CSharp (C#) Code Snippet zeigt, wie man die IP Adresse eines PCs ermittelt.

private void ListIPAddresses()
{
    IPHostEntry myIPHostEntry = Dns.GetHostEntry(Dns.GetHostName());

    foreach (IPAddress myIPAddress in myIPHostEntry.AddressList)
    {
        Console.WriteLine(myIPAddress.ToString());    
    }
}