Horje
c# get ip address Code Example
c# get pc ip address
public static string GetLocalIPAddress()
{
    var host = Dns.GetHostEntry(Dns.GetHostName());
    foreach (var ip in host.AddressList)
    {
        if (ip.AddressFamily == AddressFamily.InterNetwork)
        {
            return ip.ToString();
        }
    }
    throw new Exception("No network adapters with an IPv4 address in the system!");
}
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}");
Source: ipify.org




Csharp

Related
convert string to number C# Code Example convert string to number C# Code Example
dictionary c# iterate Code Example dictionary c# iterate Code Example
how to take user input in string in c# Code Example how to take user input in string in c# Code Example
for statement syntax C sharp Code Example for statement syntax C sharp Code Example
how unsort the data table options Code Example how unsort the data table options Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9