using System; namespace Microsoft.Win32 { internal static partial class NativeMethods { /// /// Represents a wireless network profile /// public class NetworkProfile { /// /// Initializes a new instance of the class using the GUID of the network profile. /// /// The GUID of the network profile. /// The name of the network profile. public NetworkProfile(Guid guid, string name) : this(guid.ToString("B"), name) { } private NetworkProfile(string guid, string name) { this.Name = name; this.Id = new Guid(guid); } /// /// Gets the name of the profile. /// /// The name. public string Name { get; private set; } /// /// Gets the GUID of the profile. /// /// The id. public Guid Id { get; private set; } /// /// Determines whether the specified is equal to this instance. /// /// The to compare with this instance. /// /// true if the specified is equal to this instance; otherwise, false. /// /// /// The parameter is null. /// public override bool Equals(object obj) { if (obj is NetworkProfile) return ((NetworkProfile)obj).Id == this.Id; else if (obj is Guid) return ((Guid)obj) == this.Id; return false; } /// /// Returns a hash code for this instance. /// /// /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// public override int GetHashCode() { return Id.GetHashCode(); } /// /// Returns a that represents this instance. /// /// /// A that represents this instance. /// public override string ToString() { return this.Name; } /// /// Gets all local profiles. /// /// Array of objects. public static NetworkProfile[] GetAllLocalProfiles() { try { return NetworkListManager.GetNetworkList(); } catch { } return new NetworkProfile[0]; } } } }