Click here to Skip to main content
12,449,717 members (68,949 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

5.1K views
2 bookmarked
Posted

Whats My IP Address ?

, 14 Sep 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
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>();
        }
    }
}

Smile | :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author


You may also be interested in...

Pro
Pro

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160811.3 | Last Updated 14 Sep 2011
Article Copyright 2011 by Mohammad A Rahman
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid