Skip to content

Instantly share code, notes, and snippets.

@JohnMGant
Created December 9, 2020 20:55
Show Gist options
  • Save JohnMGant/633fb7360f1654af29a50965bb9b4953 to your computer and use it in GitHub Desktop.
Save JohnMGant/633fb7360f1654af29a50965bb9b4953 to your computer and use it in GitHub Desktop.
internal static class ExtensionMethods
{
public static bool TryDequeue<T>(this Queue<T> queue, out T result)
{
result = default;
if (queue == null || !queue.Any())
{
return false;
}
result = queue.Dequeue();
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment