Exemple #1
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            Producte otherobj = obj as Producte;

            if (otherobj != null)
            {
                return(this.preu.CompareTo(otherobj.Preu));
            }
            else
            {
                throw new ArgumentException("Error!!");
            }
        }
Exemple #2
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            else
            {
                Producte p = (Producte)obj;

                if (preu == p.Preu)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }