You can obtain a list of the configured networks from the
Networks property of the
ConnectionMonitor.
NetworkCollection netList = sampleMonitor.Networks;
The
NetworkCollection class inherits from the generic collection class
KeyedCollection, and implements the
IEnumerable interface.
StringBuilder builder = new StringBuilder();
foreach (Network netwk in netList)
{
builder.Append(String.Format("Name: {0}, Connected: {1}",
netwk.Name, netwk.Connected.ToString()));
builder.Append("\n");
}
To obtain a list of the connected networks only, use the
ActiveNetworks property of the
NetworkCollection class.
ReadOnlyCollection<network> activeNetworks = sampleMonitor.Networks.ActiveNetworks;
No comments:
Post a Comment