private class TimestampDetail
public DateTime Timestamp { get; set; }
private class FeedDetails
public int Feed { get; set; }
public TimestampDetail? TimestampDetail { get; set; }
public static void Main()
DateTime? storedTimestamp = null;
new FeedDetails { Feed = 1, TimestampDetail = new TimestampDetail { Timestamp = DateTime.Now } },
new FeedDetails { Feed = 2, TimestampDetail = null },
new FeedDetails { Feed = 3, TimestampDetail = new TimestampDetail { Timestamp = DateTime.Now } },
new FeedDetails { Feed = 4, TimestampDetail = new TimestampDetail { Timestamp = DateTime.Now.AddSeconds(10) } },
new FeedDetails { Feed = 5, TimestampDetail = new TimestampDetail { Timestamp = DateTime.Now.AddSeconds(10) } }
var feedToProcess = testData
ofg!.TimestampDetail?.Timestamp != null &&
(storedTimestamp == null ||
storedTimestamp <= ofg!.TimestampDetail?.Timestamp))
.Select(ofg => ofg.Feed);
var feedOutOfOrder = testData
ofg!.TimestampDetail?.Timestamp == null ||
storedTimestamp > ofg!.TimestampDetail?.Timestamp)
.Select(ofg => ofg.Feed);
Console.WriteLine("To process:");
foreach (var x in feedToProcess)
Console.WriteLine("Out of order:");
foreach (var x in feedOutOfOrder)