class Program { static void Main(string[] args) { IPHostEntry host; host = Dns.GetHostEntry(Dns.GetHostName()); foreach(IPAddress ip in host.AddressList) { if (ip.AddressFamily == AddressFamily.InterNetwork) { Console.WriteLine("Your machine IP Address is :"+ip); } //Console.ReadLine(); } } }
SOFTWARE PROGRAMMING TUTORIAL