Added PredicateBuilder

This commit is contained in:
TLRZ Seyfferth
2017-05-11 14:06:38 +02:00
parent 6a273efd08
commit c94e357006
4 changed files with 123 additions and 42 deletions
+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chrosey.Extensions.Wrapper
{
public class ConcurrentQueueWrapper<T>
{
private readonly ConcurrentQueue<T> queue = new ConcurrentQueue<T>();
public event EventHandler Changed;
protected virtual void OnChanged()
{
if (Changed != null) Changed(this, EventArgs.Empty);
}
public virtual void Enqueue(T item)
{
queue.Enqueue(item);
OnChanged();
}
public int Count { get { return queue.Count; } }
public virtual bool TryDequeue(out T item)
{
if (queue.TryDequeue(out item))
{
OnChanged();
return true;
}
return false;
}
}
}