//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); }
//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); }
//To make the sort function work public int CompareTo(object obj) { Doggo doggo = obj as Doggo; return(String.Compare(name, doggo.name)); }