Peek Returns the object at the beginning of the Queue without removing it.
What if I want to do the same thing with the “last object in the queue”. I.e. the “newest” one (the one was just inserted).
I’ve tried queue.Reverse().Peek() but this doesn’t compile.
Try the following:
queue.Reverse().Peek()does not work becauseReverse()returns an instance ofIEnumerable<T>, which does not define aPeek()method.