METHOD

PriorityQueue.TryDequeue

Returns and removes a minimum-priority element and its priority if present; false when empty.

Formal Syntax & Structure

csharp syntaxcsharp
bool TryDequeue(out TElement element, out TPriority priority)

Working Example

Example Snippetcsharp
using System.Collections.Generic;var q = new PriorityQueue<string,int>();q.Enqueue("A",1);if(q.TryDequeue(out var item,out var rank)) System.Console.WriteLine(item);
C# & .NET Reference