Skip to content

Latest commit

 

History

History
53 lines (42 loc) · 2.2 KB

README.md

File metadata and controls

53 lines (42 loc) · 2.2 KB

logo

NuGet Status MIT Licence Build Status donate

📎 Utilities to aid in utilizing the ever-useful .NET structure BlockingCollection<T>

Installation

Find it on nuget!

PM> Install-Package BlockingCollectionExtensions -Version 6.0.1

API

Static Additive Utilities

/// <summary>
/// Transfer contents of a generic enumerable into a target blocking collection,
/// determine whether blocking collection should complete adding when enumerable has finished being added
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="target"></param>
/// <param name="source"></param>
/// <param name="completeAddingWhenDone"></param>
public static void AddFromEnumerable<T>(this BlockingCollection<T> target, IEnumerable<T> source,
    bool completeAddingWhenDone);
    

Static Transformative Utilities

/// <summary>
/// Coalesce a target blocking collection to a structure that implements the IProducerConsumerCollection interface
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="collection"></param>
/// <param name="millisecondsTimeout"></param>
/// <param name="cancellationToken"></param>
/// <param name="count"></param>
/// <param name="isSynchronized"></param>
/// <param name="syncRoot"></param>
/// <returns></returns>
public static IProducerConsumerCollection<T> ToProducerConsumerCollection<T>(
    this BlockingCollection<T> collection, int millisecondsTimeout, CancellationToken cancellationToken,
    int count, bool isSynchronized, object syncRoot);