Search Results for

    Show / Hide Table of Contents
    View Source

    Class TopoGraph<TKey, TItem>

    Represents a generic DAG that can be topologically sorted.

    Inheritance
    System.Object
    TopoGraph
    Namespace: Umbraco.Cms.Core.Collections
    Assembly: Umbraco.Core.dll
    Syntax
    public class TopoGraph<TKey, TItem> : TopoGraph
    Type Parameters
    Name Description
    TKey

    The type of the keys.

    TItem

    The type of the items.

    Constructors

    View Source

    TopoGraph(Func<TItem, TKey>, Func<TItem, Nullable<IEnumerable<TKey>>>)

    Initializes a new instance of the TopoGraph<TKey, TItem> class.

    Declaration
    public TopoGraph(Func<TItem, TKey> getKey, Func<TItem, IEnumerable<TKey>?> getDependencies)
    Parameters
    Type Name Description
    Func<TItem, TKey> getKey

    A method that returns the key of an item.

    Func<TItem, System.Nullable<IEnumerable<TKey>>> getDependencies

    A method that returns the dependency keys of an item.

    Methods

    View Source

    AddItem(TItem)

    Adds an item to the graph.

    Declaration
    public void AddItem(TItem item)
    Parameters
    Type Name Description
    TItem item

    The item.

    View Source

    AddItems(IEnumerable<TItem>)

    Adds items to the graph.

    Declaration
    public void AddItems(IEnumerable<TItem> items)
    Parameters
    Type Name Description
    IEnumerable<TItem> items

    The items.

    View Source

    GetSortedItems(Boolean, Boolean, Boolean)

    Gets the sorted items.

    Declaration
    public IEnumerable<TItem> GetSortedItems(bool throwOnCycle = true, bool throwOnMissing = true, bool reverse = false)
    Parameters
    Type Name Description
    System.Boolean throwOnCycle

    A value indicating whether to throw on cycles, or just ignore the branch.

    System.Boolean throwOnMissing

    A value indicating whether to throw on missing dependency, or just ignore the dependency.

    System.Boolean reverse

    A value indicating whether to reverse the order.

    Returns
    Type Description
    IEnumerable<TItem>

    The (topologically) sorted items.

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • TopoGraph(Func<TItem, TKey>, Func<TItem, Nullable<IEnumerable<TKey>>>)
    • Methods
      • AddItem(TItem)
      • AddItems(IEnumerable<TItem>)
      • GetSortedItems(Boolean, Boolean, Boolean)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX