get internet ip address c# code example
Example 1: c# get wifi ip address
string myIP = Dns.GetHostAddresses(Dns.GetHostName())[0].Address.ToString();
Example 2: c# get ip address
var httpClient = new HttpClient();
var ip = await httpClient.GetStringAsync("https://api.ipify.org");
Console.WriteLine($"My public IP address is: {ip}");