Esenlikler.
using System.Runtime.InteropServices;
[DllImport("wininet.dll")]
private static extern bool InternetGetConnectedState(out int Description, int ReservedValue);
public static bool IsConnectedToInternet => InternetGetConnectedState(out int Desc, 0);


if (IsConnectedToInternet)
{
//var
}
else
{
//yok
}