Пример #1
0
 //Gets the index of a specific dog
 private int GetIndex(Doggo Doggo)
 {
     for (int i = 0; i < Doggos.Count; i++)
     {
         if (Doggos[i].Equals(Doggo))
         {
             return(i);
         }
     }
     //Index value -1 if the dog wasnt found
     return(-1);
 }
Пример #2
0
        //Equality check
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }
            Doggo doggo = (Doggo)obj;

            return((Name == doggo.Name &&
                    Age == doggo.Age &&
                    Length == doggo.Length &&
                    Withers == doggo.Withers &&
                    Weight == doggo.Weight &&
                    Sex == doggo.Sex) ? true : false);
        }
Пример #3
0
        //To make the sort function work
        public int CompareTo(object obj)
        {
            Doggo doggo = obj as Doggo;

            return(String.Compare(name, doggo.name));
        }