i want to know if my function did remove from my list or not here is my code:
public int RemovePassenger(string name)
{
Passengers.RemoveAll(x => x.PassengerName == name);
return //if the passenger actually been remove or not
}
Because there can be maybe more than one passenger with the same name, I suppose.
Anyway… RemoveAll should not and never fail on what you are doing. You could simply return the result of RemoveAll (the number of removed entries) which could be more useful in the future.