Created
December 9, 2020 20:55
-
-
Save JohnMGant/633fb7360f1654af29a50965bb9b4953 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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