Get IPv4 from ipconfig from a C# console program

Hi all,

How can I get the IPv4 that shows up when you run ipconfig into a c# console app?
ehensensAsked:
Who is Participating?
 
jjardineConnect With a Mentor Commented:
Try this:

System.net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList[0].ToString();
0
 
ehensensAuthor Commented:
Thanks a bunch.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.