Bewerken

Delen via


PriorityQueue<TElement,TPriority>.TryPeek(TElement, TPriority) Method

Definition

Returns a value that indicates whether there is a minimal element in the PriorityQueue<TElement,TPriority>, and if one is present, copies it and its associated priority to the element and priority arguments. The element is not removed from the PriorityQueue<TElement,TPriority>.

public:
 bool TryPeek([Runtime::InteropServices::Out] TElement % element, [Runtime::InteropServices::Out] TPriority % priority);
public bool TryPeek (out TElement element, out TPriority priority);
member this.TryPeek : 'Element * 'Priority -> bool
Public Function TryPeek (ByRef element As TElement, ByRef priority As TPriority) As Boolean

Parameters

element
TElement

When this method returns, contains the minimal element in the queue.

priority
TPriority

When this method returns, contains the priority associated with the minimal element.

Returns

true if there is a minimal element; false if the PriorityQueue<TElement,TPriority> is empty.

Applies to