I have a list of tickets. Each ticket belongs to a single event. I want create a list of all events from tickets. I can get this list, but the same event (value) is repeated in the list. How can I ensure that an event is only added the list once?
List<int> tickets = new List<int>();
List<Event> events = new List<Event>();
foreach (var s in tickets)
{
events.Add(_context.Event.Find(s));
}