public void AddEvent(string message, string component) { lock (Events) { var lastEvent = Events.Count == 0 ? null : Events.Last(); var ev = new TimelineEvent(message, component); ev.DeltaFromPreviousEvent = lastEvent == null ? TimeSpan.Zero : ev.Timestamp - lastEvent.Timestamp; Events.Add(ev); } }