Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read Item in Queue<T> before Dequeueing

I have a Queue<T>

In my T I have a DateLoaded property.

I want to say if the DateLoaded is older than 5 minutes dequeue it and execute code on T

Is this possible?

like image 338
Jon Avatar asked Apr 16 '26 05:04

Jon


2 Answers

Use the Peek() method.

like image 115
Mark Cidade Avatar answered Apr 18 '26 18:04

Mark Cidade


You can call Peek to look at what the first element in the queue is.

like image 34
Harry Steinhilber Avatar answered Apr 18 '26 17:04

Harry Steinhilber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!