Kiểm tra máy tính có kết nối hay không

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace Coderbuddy
{

    public class CheckInternetConnection
    {
        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);



        public bool IsInternetConnectionAvailable()
        {
            int Desc;
            return InternetGetConnectedState(out Desc, 0);
        }
    }
}