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 RedBlackTree<TKey, TValue>

A red–black tree is a type of self-balancing binary search tree, a data structure used in computer science, typically to implement associative arrays.

Inheritance
System.Object
BinarySearchTreeBase<System.Collections.Generic.KeyValuePair<TKey, TValue>>
RedBlackTree<System.Collections.Generic.KeyValuePair<TKey, TValue>>
RedBlackTree<TKey, TValue>
Inherited Members
RedBlackTree<KeyValuePair<TKey, TValue>>.AddItem(KeyValuePair<TKey, TValue>)
RedBlackTree<KeyValuePair<TKey, TValue>>.RemoveItem(KeyValuePair<TKey, TValue>)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue>)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Clear()
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue>)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[], Int32)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.DepthFirstTraversal(IVisitor<KeyValuePair<TKey, TValue>>)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.GetEnumerator()
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.GetOrderedEnumerator()
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue>)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.IEnumerable.GetEnumerator()
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindMaximumNode(BinaryTree<KeyValuePair<TKey, TValue>>)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindMinimumNode(BinaryTree<KeyValuePair<TKey, TValue>>)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.ClearItems()
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindMaximumNode()
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindMinimumNode()
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindNode(KeyValuePair<TKey, TValue>)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.FindNode<TSearch>(TSearch, BinarySearchTreeBase.CustomComparison<TSearch>)
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Comparer
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Count
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.IsEmpty
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.IsReadOnly
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Height
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Maximum
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Minimum
BinarySearchTreeBase<KeyValuePair<TKey, TValue>>.Tree
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 class RedBlackTree<TKey, TValue> : RedBlackTree<KeyValuePair<TKey, TValue>>, ISearchTree<KeyValuePair<TKey, TValue>>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
Type Parameters
TKey

The type of the key.

TValue

The type of the value.

Constructors

RedBlackTree()

Initializes a new instance of the RedBlackTree<TKey, TValue> class.

Declaration
public RedBlackTree()

RedBlackTree(IComparer<TKey>)

Initializes a new instance of the RedBlackTree<TKey, TValue> class.

Declaration
public RedBlackTree(IComparer<TKey> comparer)
Parameters
System.Collections.Generic.IComparer<TKey> comparer

The comparer.

RedBlackTree(Comparison<TKey>)

Initializes a new instance of the RedBlackTree<TKey, TValue> class.

Declaration
public RedBlackTree(Comparison<TKey> comparison)
Parameters
System.Comparison<TKey> comparison

The comparison.

Properties

Item[TKey]

Gets or sets the value with the specified key.

Declaration
public TValue this[TKey key] { get; set; }
Parameters
TKey key

Property Value
TValue

The key of the item to set or get.

Implements
System.Collections.Generic.IDictionary<TKey, TValue>.Item[TKey]

Keys

Gets an System.Collections.Generic.ICollection<T> containing the keys of the System.Collections.Generic.IDictionary<TKey, TValue>.

Declaration
public ICollection<TKey> Keys { get; }
Property Value
System.Collections.Generic.ICollection<TKey>

Implements
System.Collections.Generic.IDictionary<TKey, TValue>.Keys

Values

Gets an System.Collections.Generic.ICollection<T> containing the values in the System.Collections.Generic.IDictionary<TKey, TValue>.

Declaration
public ICollection<TValue> Values { get; }
Property Value
System.Collections.Generic.ICollection<TValue>

Implements
System.Collections.Generic.IDictionary<TKey, TValue>.Values

Methods

Add(TKey, TValue)

Adds an element with the provided key and value to the System.Collections.Generic.IDictionary<TKey, TValue>.

Declaration
public void Add(TKey key, TValue value)
Parameters
TKey key

The object to use as the key of the element to add.

TValue value

The object to use as the value of the element to add.

Implements
System.Collections.Generic.IDictionary<TKey, TValue>.Add(TKey, TValue)

Contains(KeyValuePair<TKey, TValue>)

Determines whether this tree contains the given item.

Declaration
public override bool Contains(KeyValuePair<TKey, TValue> item)
Parameters
System.Collections.Generic.KeyValuePair<TKey, TValue> item

The item.

Returns
System.Boolean

true if the item is in this tree; otherwise, false.

Overrides
Telerik.Windows.Diagrams.Core.BinarySearchTreeBase<System.Collections.Generic.KeyValuePair<TKey, TValue>>.Contains(System.Collections.Generic.KeyValuePair<TKey, TValue>)
Implements
System.Collections.Generic.ICollection<T>.Contains(T)

ContainsKey(TKey)

Determines whether the System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the specified key.

Declaration
public bool ContainsKey(TKey key)
Parameters
TKey key

The key to locate in the System.Collections.Generic.IDictionary<TKey, TValue>.

Returns
System.Boolean

True if the System.Collections.Generic.IDictionary<TKey, TValue> contains an element with the key; otherwise, false.

Implements
System.Collections.Generic.IDictionary<TKey, TValue>.ContainsKey(TKey)
Exceptions
System.ArgumentNullException

key is null.

Remove(TKey)

Removes the element with the specified key from the System.Collections.Generic.IDictionary<TKey, TValue>.

Declaration
public bool Remove(TKey key)
Parameters
TKey key

The key of the element to remove.

Returns
System.Boolean

True if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original System.Collections.Generic.IDictionary<TKey, TValue>.

Implements
System.Collections.Generic.IDictionary<TKey, TValue>.Remove(TKey)
Exceptions
System.ArgumentNullException

key is null.

System.NotSupportedException

The System.Collections.Generic.IDictionary<TKey, TValue> is read-only.

TryGetValue(TKey, out TValue)

Attempts to the get value.

Declaration
public bool TryGetValue(TKey key, out TValue value)
Parameters
TKey key

The key.

TValue value

The value.

Returns
System.Boolean

Implements
System.Collections.Generic.IDictionary<TKey, TValue>.TryGetValue(TKey, TValue)

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.