skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class PriorityQueue<TValue, TPriority>

Priority queue implementation based on a Telerik.Windows.Diagrams.Core.RedBlackTreeList`2.

Inheritance
System.Object
PriorityQueue<TValue, TPriority>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.WinControls.RadDiagram.dll

Syntax

public sealed class PriorityQueue<TValue, TPriority> : ICollection<TValue>, IEnumerable<TValue>, IEnumerable
Type Parameters
TValue

The data type of the value.

TPriority

The data type of the priority indicator.

Remarks

See http://en.wikipedia.org/wiki/Priority_queue .

Constructors

PriorityQueue(OrderType)

Initializes a new instance of the PriorityQueue<TValue, TPriority> class.

Declaration
public PriorityQueue(OrderType queueType = OrderType.Descending)
Parameters
OrderType queueType

Type of the queue.

PriorityQueue(OrderType, IComparer<TPriority>)

Initializes a new instance of the PriorityQueue<TValue, TPriority> class.

Declaration
public PriorityQueue(OrderType queueType, IComparer<TPriority> comparer)
Parameters
OrderType queueType

Type of the queue.

System.Collections.Generic.IComparer<TPriority> comparer

The comparer.

PriorityQueue(OrderType, Comparison<TPriority>)

Initializes a new instance of the PriorityQueue<TValue, TPriority> class.

Declaration
public PriorityQueue(OrderType queueType, Comparison<TPriority> comparison)
Parameters
OrderType queueType

Type of the queue.

System.Comparison<TPriority> comparison

The comparison.

Properties

Count

Gets the number of elements still in the queue.

Declaration
public int Count { get; }
Property Value
System.Int32

Implements
System.Collections.Generic.ICollection<T>.Count

DefaultPriority

Gets or sets the default priority when an item is added.

Declaration
public TPriority DefaultPriority { get; set; }
Property Value
TPriority

The default priority.

Remarks

The default value is zero if not set.

IsReadOnly

Gets false since this queue is never read-only.

Declaration
public bool IsReadOnly { get; }
Property Value
System.Boolean

false.

Implements
System.Collections.Generic.ICollection<T>.IsReadOnly

Methods

Add(TValue)

Adds the specified item to the queue.

Declaration
public void Add(TValue item)
Parameters
TValue item

The item.

Implements
System.Collections.Generic.ICollection<T>.Add(T)

AddPriorityGroup(IEnumerable<TValue>, TPriority)

Adds the specified items to the priority queue with the specified priority.

Declaration
public void AddPriorityGroup(IEnumerable<TValue> items, TPriority priority)
Parameters
System.Collections.Generic.IEnumerable<TValue> items

The items.

TPriority priority

The priority.

Exceptions
System.ArgumentNullException

items is a null reference (Nothing in Visual Basic).

Clear()

Clears this queue of all its items..

Declaration
public void Clear()
Implements
System.Collections.Generic.ICollection<T>.Clear()

Contains(TValue)

Returns whether the given item is present in the queue.

Declaration
public bool Contains(TValue item)
Parameters
TValue item

The item.

Returns
System.Boolean

true if the queue contains the given item; otherwise, false.

Implements
System.Collections.Generic.ICollection<T>.Contains(T)

CopyTo(TValue[], Int32)

Copies the content of the queue to the given array.

Declaration
public void CopyTo(TValue[] array, int arrayIndex)
Parameters
TValue[] array

The array.

System.Int32 arrayIndex

Index of the array.

Implements
System.Collections.Generic.ICollection<T>.CopyTo(T[], System.Int32)

Dequeue(out TPriority)

Dequeues the item from the head of the queue.

Declaration
public TValue Dequeue(out TPriority priority)
Parameters
TPriority priority

The priority of the item to dequeue.

Returns
TValue

The item at the head of the queue.

Exceptions
System.InvalidOperationException

The PriorityQueue<TValue, TPriority> is empty.

Enqueue(TValue)

Enqueues the specified item.

Declaration
public void Enqueue(TValue item)
Parameters
TValue item

The item.

Enqueue(TValue, TPriority)

Enqueues the specified item.

Declaration
public void Enqueue(TValue item, TPriority priority)
Parameters
TValue item

The item.

TPriority priority

The priority.

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration
public IEnumerator<TValue> GetEnumerator()
Returns
System.Collections.Generic.IEnumerator<TValue>

A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection.

Implements
System.Collections.Generic.IEnumerable<T>.GetEnumerator()

GetKeyEnumerator()

Returns an enumerator that iterates through the keys in the collection.

Declaration
public IEnumerator<KeyValuePair<TPriority, TValue>> GetKeyEnumerator()
Returns
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TPriority, TValue>>

A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the keys in the collection.

GetPriorityGroup(TPriority)

Removes the items with the specified priority.

Declaration
public IList<TValue> GetPriorityGroup(TPriority priority)
Parameters
TPriority priority

The priority.

Returns
System.Collections.Generic.IList<TValue>

The items with the specified priority.

Peek()

Peeks at the item in the front of the queue, without removing it.

Declaration
public TValue Peek()
Returns
TValue

The item at the front of the queue.

Peek(out TPriority)

Peeks at the item in the front of the queue, without removing it.

Declaration
public TValue Peek(out TPriority priority)
Parameters
TPriority priority

The priority of the item.

Returns
TValue

The item at the front of the queue.

Pop()

Dequeues the item at the front of the queue.

Declaration
public TValue Pop()
Returns
TValue

The item at the front of the queue.

See Also
Pop()

Push(TValue)

Pushes the specified item in the queue.

Declaration
public void Push(TValue item)
Parameters
TValue item

The item.

Push(TValue, TPriority)

Adds an item to the System.Collections.Generic.ICollection<T>.

Declaration
public void Push(TValue item, TPriority priority)
Parameters
TValue item

The object to add to the System.Collections.Generic.ICollection<T>.

TPriority priority

The priority of the item.

Remove(TValue)

Removes the specified item from this queue.

Declaration
public bool Remove(TValue item)
Parameters
TValue item

The item.

Returns
System.Boolean

Implements
System.Collections.Generic.ICollection<T>.Remove(T)

Remove(TValue, out TPriority)

Removes the first occurrence of the specified item from the property queue.

Declaration
public bool Remove(TValue item, out TPriority priority)
Parameters
TValue item

The item to remove.

TPriority priority

The priority associated with the item.

Returns
System.Boolean

true if the item exists in the PriorityQueue<TValue, TPriority> and has been removed; otherwise false.

RemovePriorityGroup(TPriority)

Removes the items with the specified priority.

Declaration
public bool RemovePriorityGroup(TPriority priority)
Parameters
TPriority priority

The priority.

Returns
System.Boolean

true if the priority exists in the PriorityQueue<TValue, TPriority> and has been removed; otherwise false.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
System.Collections.IEnumerator

An System.Collections.IEnumerator object that can be used to iterate through the collection.

Implements
System.Collections.IEnumerable.GetEnumerator()

Extension Methods

CommonExtensions.AddRange<T>(ICollection<T>, IEnumerable<T>)
CommonExtensions.ContainsAny<T>(IEnumerable<T>, IEnumerable<T>)
CommonExtensions.ForEach<T>(IEnumerable<T>, Action<T>)
CommonExtensions.Clone<T>(IEnumerable<T>)
SvgExtentions.Traverse<T>(IEnumerable<T>, Func<T, IEnumerable<T>>)
SvgExtentions.Traverse<T>(T, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(IEnumerable<T>, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(T, Func<T, IEnumerable<T>>)
Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.