private void TimerOnTick(object sender, EventArgs eventArgs) { var currentTime = DateTime.Now; var itemsToRemove = NotificationMessages.Where(x => currentTime - x.CreateTime >= NotificationLifeTime).Select(x => x.Id).ToList(); foreach (var id in itemsToRemove) { Hide(id); } }