Get IP Address, Host Name, Domain Name in C#

Getiing IP address, host name, domain Name through c# code.
 

string LocalIp = string.Empty;

string Domain = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;

string Host = System.Net.Dns.GetHostName();

if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())

{

    return null;

}

System.Net.IPHostEntry host = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());

foreach (System.Net.IPAddress ip in host.AddressList)

{

    if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)

    {

       LocalIp = ip.ToString();

       break;

    }

}

string IpWidHost = String.Format("[Domain-{0} : Host-{1} : IP-{2}]", Domain, Host, LocalIp);           

Next Recommended Reading How to Get Public IP Address Using C#