Click here to Skip to main content
11,580,572 members (72,442 online)
Click here to Skip to main content

Tagged as

Whats My IP Address ?

, 14 Sep 2011 CPOL 4.2K 2
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...

Comments and Discussions

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