I'm attempting to use this extension method to get the earliest item from the ConcurrentDictionary, based on 'RunDate'.
I need to process the items in the ConcurrentDictionary in ascending order based on the 'RunDate'.
I was planning to use the OrderBy along with Take1 to get this item to process, but I'm not getting my topOne var to return anything but null.
Is my approach feasible? If so, if you have sample of how to perform this with C#, I would appreciate it.
private ConcurrentDictionary<Guid, POptions> PQueue = new ConcurrentDictionary<Guid, POptions>();
//Add items to this dictionary - initiated from a UI
//Timer process to process the earliest 'RunDate' item from the ConcurrentDictionary
//I get null values returned by this line of code, but I know there are multiple items in the ConcurrentDictionary
var topOne = PQueue.OrderBy(q => q.Value.RunDate).ToList().Take(1);