using System;
using System.Net.NetworkInformation;
class MainClass
{
private static void NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
{
if (e.IsAvailable)
{
Console.WriteLine("Network Available");
}
else
{
Console.WriteLine("Network Unavailable");
}
}
static void Main(string[] args)
{
NetworkChange.NetworkAvailabilityChanged += NetworkAvailabilityChanged;
}
}