queue in C# with different prioritys that gives back the return of the method i call with the queue items
example code:
List<QueueReturnItem> queueItems = new List<QueueReturnItem>();
foreach(item in items) {
queueItems.Add(Queue.Add(item, Priority.HIGH));
}
// wait til queue is ready
// do stuff with queueitems
the problem now is not creating the queue and stuff, i just don't understand how i can return the data
could someone tell me how to do that?
With linq you can orderBy priority so take(1), then remove it from the list by value
so, when i call queueItems.Add(x); that item should get added to that list and in that queueItems object it will call (maybe after a few seconds, maybe directly, depends on how many items are in that queue) a method with some return value and i need that value
but i do need that return value after the foreach loop, so i can put all items in that queue and wait for them to get 'executed'
Обсуждают сегодня