Exemplo n.º 1
0
 public override int GetHashCode()
 {
     return(BitConverter.ToInt32(MyMACAddress.ToBytes(), 0));
 }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            Adapter a;

            try
            {
                a = (Adapter)obj;
            }
            catch (InvalidCastException)
            {
                return(false);
            }

            if (MyMACAddress == null)
            {
                if (a.MyMACAddress != null)
                {
                    return(false);
                }
            }
            else if (!MyMACAddress.Equals(a.MyMACAddress))
            {
                return(false);
            }

            if (LocalIP == null)
            {
                if (a.LocalIP != null)
                {
                    return(false);
                }
            }
            else if (!LocalIP.Equals(a.LocalIP))
            {
                return(false);
            }

            if (SubnetMask == null)
            {
                if (a.SubnetMask != null)
                {
                    return(false);
                }
            }
            else if (!SubnetMask.Equals(a.SubnetMask))
            {
                return(false);
            }

            if (DefaultGateway == null)
            {
                if (a.DefaultGateway != null)
                {
                    return(false);
                }
            }
            else if (!DefaultGateway.Equals(a.DefaultGateway))
            {
                return(false);
            }

            if (DNS == null)
            {
                if (a.DNS != null)
                {
                    return(false);
                }
            }
            else if (!DNS.Equals(a.DNS))
            {
                return(false);
            }


            if ((Name == a.Name) && (OtherEndID == a.OtherEndID) && (Connected == a.Connected) && (Associated == a.Associated))
            {
                return(true);
            }
            return(false);
        }