using System.Collections.Generic;
internal staticclass Utilities
{
internal static bool TryDequeue<T>(this Queue<T> queue, out T result) where T : class
{
lock (queue)
{
if (queue.Count == 0)
{
result = null;
return false;
}
result = queue.Dequeue();
}
return true;
}
}