ConcurrentStack(Of T)

ConcurrentStack(Of T) is the thread-safe implementation of the Stack(Of T) generic collection and works according to the LIFO (Last-In, First-Out) logic. The following code shows an example of using this collection:

image

The big difference between this collection and its thread-unsafe counterpart is that you can also add an array of items invoking PushRange, whereas you still invoke Push to add a single item. To remove an array from the stack, you invoke TryPopRange, which takes three arguments: the target array that will store the removed items, the start index, and the number of items to remove. Both PushRange and TryPopRange ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.