May 2010
Intermediate to advanced
1272 pages
61h 18m
English
ConcurrentQueue(Of T)The ConcurrentQueue(Of T) collection is just a thread-safe implementation of the Queue(Of T) collection; therefore, it takes the logic of FIFO (First-In, First Out), where the first element in the collection is the first to be removed. The following code shows an example:

The main difference with Queue is how items are removed from the queue. In this concurrent implementation, you invoke TryDequeue, which passes the removed item to a result variable by reference. The method returns True in cases of success, otherwise False. Still the Count property returns the number of items in the queue.
Read now
Unlock full access