public void RemoveMapItem() { // take the data from list to remove it without having enumeration problems (ToList) try { List <MapItem> dropsToRemove = DroppedList.Where(dl => dl.CreatedDate.AddMinutes(3) < DateTime.Now); Parallel.ForEach(dropsToRemove, drop => { Broadcast(StaticPacketHelper.Out(UserType.Object, drop.TransportId)); DroppedList.Remove(drop.TransportId); }); } catch (Exception e) { Logger.Error(e); } }
public void RemoveMapItem() { // take the data from list to remove it without having enumeration problems (ToList) try { List <MapItem> dropsToRemove = DroppedList.GetAllItems().Where(dl => dl.CreatedDate.AddMinutes(3) < DateTime.Now).ToList(); foreach (MapItem drop in dropsToRemove) { Broadcast(drop.GenerateOut(drop.TransportId)); DroppedList.Remove(drop.TransportId); } } catch (Exception e) { Logger.Error(e); } }