使用 `My` 命名空间
在 Visual Basic.NET 中,可以使用My.Computer.Network.IsAvailable 来获取网络是否已经连接。此函数的定义如下所示:
'''**********************************************************************
''';IsAvailable
''' <summary>
''' Indicates whether or not the local machine is connected to an IP network.
''' </summary>
''' <value>True if connected, otherwise False</value>
''' <remarks></remarks>
Public ReadOnly Property IsAvailable() As Boolean
Get
Return NetInfoAlias.NetworkInterface.GetIsNetworkAvailable()
End Get
End Property
由此引入了C#中获取网络状态的方法。 继续阅读“.NET 获取网络连接状态的方法”
