I am trying to use IEnumerable.Except function in c# 4.0 to get the difference between two lists like this:
//Function to get only available rooms out of all rooms of the hotel...
public IEnumerable<Room> GetAvailableRooms(DateTime arrival, DateTime leaving)
{
//.....
foreach (Room value in v)
room_list.Add(value);
return (dal.GetAllRooms()).Except(room_list);
}
but the function doesn't work - it doesn't remove the items of room_list.
(I checked in debugging and room_list contains the desired values)
dal.GetAllRooms is a functions that gets all rooms from xml file in Data Access Layer.
I am sure that the problem is about xml because when I use my DAL implemention with lists (not xml) the same exact function works fine.