ObservableConcurrentQueue.dll 1.0.1

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package ObservableConcurrentQueue.dll --version 1.0.1
NuGet\Install-Package ObservableConcurrentQueue.dll -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ObservableConcurrentQueue.dll" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ObservableConcurrentQueue.dll --version 1.0.1
#r "nuget: ObservableConcurrentQueue.dll, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ObservableConcurrentQueue.dll as a Cake Addin
#addin nuget:?package=ObservableConcurrentQueue.dll&version=1.0.1

// Install ObservableConcurrentQueue.dll as a Cake Tool
#tool nuget:?package=ObservableConcurrentQueue.dll&version=1.0.1

ObservableConcurrentQueue

Using System.Collections.Concurrent.ConcurrentQueue with notifications

Get the latest version of source code from Codeplex

Or get it from NUGET:

PM> Install-Package ObservableConcurrentQueue

Documentation

if you are not familiar with ConcurrentQueue, Read more about it on MSDN

Usage

Syntax

// Create new instance
var observableConcurrentQueue = new ObservableConcurrentQueue();
// Subscribe the Handler to the event ContentChanged
observableConcurrentQueue.ContentChanged += OnObservableConcurrentQueueContentChanged;

Example of handling method:

private static void OnObservableConcurrentQueueContentChanged(
 object sender,
 NotifyConcurrentQueueChangedEventArgs args)
 {
      // Item Added
      if (args.Action == NotifyConcurrentQueueChangedAction.Enqueue)
      {
          Console.WriteLine("New Item added: {0}", args.ChangedItem);
      }
 
      // Item deleted
      if (args.Action == NotifyConcurrentQueueChangedAction.Dequeue)
      {
          Console.WriteLine("New Item deleted: {0}", args.ChangedItem);
      }
 
      // Item peeked
      if (args.Action == NotifyConcurrentQueueChangedAction.Peek)
      {
           Console.WriteLine("Item peeked: {0}", args.ChangedItem);
      }
 
      // Queue Empty
      if (args.Action == NotifyConcurrentQueueChangedAction.Empty)
      {
           Console.WriteLine("Queue is empty");
      }
 } 

Once the handler is defined, we can start adding, deleting or getting elements from the concurrentQueue, and after each operation an event will be raised and handled by the method above.

Event Args

The EventArgs object sent by the event contains 2 properties:

NotifyConcurrentQueueChangedAction Action:
  • Enqueue: If a new item has been enqueued.
  • Dequeue: an item has been dequeued.
  • Peek: an item has been peeked.
  • Empty: The last element in the queue has been dequeued and the queue is empty.
T ChangedItem:

The item which the changes applied on. can be null if the notification action is NotifyConcurrentQueueChangedAction.Empty.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated

Concurrent Queue raises event when queue content changed.