Network C# Tutorial

using System;
using System.Management;
class MainClass
{
    public static void Main()
    {
        ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'") ;
        ManagementObjectCollection queryCollection = query.Get();
        foreach( ManagementObject mo in queryCollection )
        {
            string[] addresses = (string[])mo["IPAddress"];
            foreach(string ipaddress in addresses)
            {
                Console.WriteLine("IP Address: {0}", ipaddress);
            }
        }
    }
}
IP Address: 192.168.1.101
IP Address: 0.0.0.0