Whats My IP Address ?






4.75/5 (5 votes)
namespace IpAddresses{ using System; using System.Collections.Generic; using System.Linq; using System.Net; class Program { static void Main(string[] args) { GetIPAddresses().ForEach(ip => Console.WriteLine(ip)); } ...
namespace IpAddresses
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
class Program
{
static void Main(string[] args)
{
GetIPAddresses().ForEach(ip => Console.WriteLine(ip));
}
static List<string> GetIPAddresses()
{
return Dns.GetHostAddresses(Dns.GetHostName()).Select(ipAddress => ipAddress.ToString()).ToList<string>();
}
}
}
:)