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 Heap<TData>

An implementation of the Heap data structure.

Inheritance
System.Object
Heap<TData>
Inherited Members
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 class Heap<TData> : ICollection<TData>, IEnumerable<TData>, IEnumerable
Type Parameters
TData

The type of item stored in the Heap<TData>.

Remarks

See http://en.wikipedia.org/wiki/Heap_%28data_structure%29 .

Constructors

Heap(OrderType)

Initializes a new instance of the Heap<TData> class.

Declaration
public Heap(OrderType type)
Parameters
OrderType type

The type.

Heap(OrderType, IComparer<TData>)

Initializes a new instance of the Heap<TData> class.

Declaration
public Heap(OrderType type, IComparer<TData> comparer)
Parameters
OrderType type

The type.

System.Collections.Generic.IComparer<TData> comparer

The comparer.

Heap(OrderType, Comparison<TData>)

Initializes a new instance of the Heap<TData> class.

Declaration
public Heap(OrderType type, Comparison<TData> comparer)
Parameters
OrderType type

The type.

System.Comparison<TData> comparer

The comparer.

Heap(OrderType, Int32)

Initializes a new instance of the Heap<TData> class.

Declaration
public Heap(OrderType type, int capacity)
Parameters
OrderType type

The type.

System.Int32 capacity

The capacity.

Heap(OrderType, Int32, IComparer<TData>)

Initializes a new instance of the Heap<TData> class.

Declaration
public Heap(OrderType type, int capacity, IComparer<TData> comparer)
Parameters
OrderType type

The type.

System.Int32 capacity

The capacity.

System.Collections.Generic.IComparer<TData> comparer

The comparer.

Heap(OrderType, Int32, Comparison<TData>)

Initializes a new instance of the Heap<TData> class.

Declaration
public Heap(OrderType type, int capacity, Comparison<TData> comparer)
Parameters
OrderType type

The type.

System.Int32 capacity

The capacity.

System.Comparison<TData> comparer

The comparer.

Properties

Count

Gets the number of items in this heap structure.

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

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

IsEmpty

Gets a value indicating whether this instance is empty.

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

true if this instance is empty; otherwise, false.

IsReadOnly

Returns false; the heap is never read-only.

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

true if this instance is read only; otherwise, false.

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

Root

Gets the root of the heap.

Declaration
public TData Root { get; }
Property Value
TData

Type

Gets the type of heap.

Declaration
public OrderType Type { get; }
Property Value
OrderType

The type of heap.

Methods

Add(TData)

Adds the given item to the heap.

Declaration
public void Add(TData item)
Parameters
TData item

The item to be added.

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

AddItem(TData)

Adds the given item to the heap.

Declaration
protected virtual void AddItem(TData item)
Parameters
TData item

The item.

Clear()

Clears this heap of all data.

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

ClearItems()

Clears all the objects in this instance.

Declaration
protected virtual void ClearItems()
Remarks

Notes to Inheritors: Derived classes can override this method to change the behavior of the Clear() method.

Contains(TData)

Returns whether the given item is in the heap.

Declaration
public bool Contains(TData item)
Parameters
TData item

The item to test.

Returns
System.Boolean

true if contained in this heap; otherwise, false.

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

CopyTo(TData[], Int32)

Copies the heap data to an array.

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

The array.

System.Int32 arrayIndex

Index of the array from which the copying starts.

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

GetEnumerator()

Returns an enumerator that iterates through the collection.

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

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

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

RemoveRoot()

Removes the root from the heap.

Declaration
public TData RemoveRoot()
Returns
TData

RemoveRootItem()

Removes the root item and arrange the tree in the heap.

Declaration
protected virtual void RemoveRootItem()

ToString()

Returns a System.String that represents this instance.

Declaration
public override string ToString()
Returns
System.String

A System.String that represents this instance.

Overrides
System.Object.ToString()

Explicit Interface Implementations

ICollection<TData>.Remove(TData)

Removes the specified item from the heap.

Declaration
bool ICollection<TData>.Remove(TData item)
Parameters
TData item

The item.

Returns
System.Boolean

The remove.

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

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.