Пример #1
0
        public bool Equals(Motorcicle t, Motorcicle p)
        {
            bool rs;

            rs = (t.ModelName == p.ModelName) &&
                 (t.MotoType == p.MotoType) &&
                 (t.EngineDisplacement == p.EngineDisplacement) &&
                 (t.ProductionYear == p.ProductionYear);

            return(rs);
        }
Пример #2
0
 public int Compare(Motorcicle t, Motorcicle p)
 {
     if (t.EngineDisplacement > p.EngineDisplacement)
     {
         return(1);
     }
     if (t.EngineDisplacement < p.EngineDisplacement)
     {
         return(-1);
     }
     return(0);
 }
Пример #3
0
        //public override bool Equals(object x)
        //{
        //    Motorcicle t = (Motorcicle)x;
        //    Motorcicle p = (Motorcicle)y;

        //    bool rs;

        //    rs =(t.ModelName == p.ModelName) &&
        //        (t.MotoType == p.MotoType) &&
        //        (t.EngineDisplacement == p.EngineDisplacement) &&
        //        (t.ProductionYear == p.ProductionYear);

        //    return rs;

        //}

        public int GetHashCode(Motorcicle obj)
        {
            return(Id * 13 + EngineDisplacement * 17 + ProductionYear);
        }