public void ThrowOut(Passenger passenger) { if (passenger == null) { // Nameof expressions // // -- this throw new ArgumentNullException(nameof(passenger)); // // -- takes the place of this throw new ArgumentNullException("passenger"); // // -- nameof gets rid of the hardcoded element name, allowing easier name refactorings } if (this.Passengers.Contains(passenger)) { this.Passengers.Remove(passenger); } else { throw new ArgumentException("Alas, you can't throw out who never entered. 'Tis a true pity, I say."); } }
// public string GetComplimentFor(Passenger passenger) => $"You smell great {passenger}!";