July 2015
Intermediate to advanced
1300 pages
87h 27m
English
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:
'Creating an instanceDim cs As New ConcurrentStack(Of Integer)'Adding an itemcs.Push(1)'Adding an arraycs.PushRange(New Integer() {10, 5, 10, 20})Dim items() As Integer = New Integer(3) {}'Removing an arraycs.TryPopRange(items, 0, 4)'Iterating the arrayArray.ForEach(Of Integer)(items, Sub(i) Console.WriteLine(i) End Sub)'Removing an itemDim anItem As Integercs.TryPop(anItem)Console.WriteLine(anItem)
The big difference ...