コード例 #1
0
 /// <summary>
 /// Adds the new pet to the database. Will fail if a pet with the same name
 /// already exists.
 /// </summary>
 /// <returns><c>true</c>, if new pet was added, <c>false</c> otherwise.</returns>
 /// <param name="newPet">New pet.</param>
 public bool addNewPet(Pet newPet)
 {
     if (pets.Contains (newPet))
         return false;
     pets.Add (newPet);
     return true;
 }
コード例 #2
0
 /// <summary>
 /// Removes the pet.
 /// </summary>
 /// <param name="withName">The name of the pet to be removed.</param>
 public void removePet(string withName)
 {
     Pet pet = new Pet (withName);
     if (pets.Contains (pet))
         pets.Remove (pet);
 }
コード例 #3
0
 /// <summary>
 /// Returns true if the specified pet exists
 /// </summary>
 /// <returns><c>true</c>, if pet exists, <c>false</c> otherwise.</returns>
 /// <param name="withName">The name of the pet to search for.</param>
 public bool ContainsPet(string withName)
 {
     Pet pet = new Pet (withName);
     return pets.Contains (pet);
 }