Get the item before the last in queue

Hello,

I need to get the last item and the item before last from a queue , i used get queue items and for the last one i used item.Last but i didn’t know how to get the item before last. Any idea please?

Kind Regards

@Deep_HML

Try this

Listqueue.ToArray(listqueue.Count-2)

Cheers

1 Like

Hello Anil

Thanks for your reply , so what is the expression when we need to get the first one and the before first
For the first its queueitem.First and for the before first ?

Kind Regards

@Anil_G ,

Could you explain what do you mean you would want to get before the first value ?

There would be nothing before the first item.

Hello,

If we check the queue the first item shown is the last one processed , so i need to get the last one processed and the item before it

Is it clear ?

Thanks

@Deep_HML

It would be listqueue.ToArray(0) and listqueue.ToArray(1)

Hope this helps

Cheers

1 Like

Thanks a lot @Anil_G

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.