Here are the examples of the csharp api class System.Collections.Concurrent.BlockingCollection.Add(T2) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
0
1. Example
Project: naps2
Source File: Pipeline.cs
Source File: Pipeline.cs
public override IEnumerable<T2> GetOutput(List<Task> taskList) { var collection = new BlockingCollection<T2>(); var input = previous.GetOutput(taskList); taskList.Add(TaskFactory.StartNew(() => { try { foreach (var item in input) { var result = func(item); if (!ReferenceEquals(result, null)) { collection.Add(result); } } } finally { collection.CompleteAdding(); } })); return collection.GetConsumingEnumerable(); }
0
2. Example
Project: naps2
Source File: Pipeline.cs
Source File: Pipeline.cs
public override IEnumerable<T2> GetOutput(List<Task> taskList) { var collection = new BlockingCollection<T2>(); var input = previous.GetOutput(taskList); taskList.Add(TaskFactory.StartNew(() => { try { Parallel.ForEach(input, item => { var result = func(item); if (!ReferenceEquals(result, null)) { collection.Add(result); } }); } finally { collection.CompleteAdding(); } })); return collection.GetConsumingEnumerable(); }
0
3. Example
Project: naps2
Source File: Pipeline.cs
Source File: Pipeline.cs
public override IEnumerable<T2> GetOutput(List<Task> taskList) { /n ..... /n //View Source file for more details /n }