Class DependencySorter<T>

Performs topological sorting of items based on dependencies.

Inheritance
System.Object
DependencySorter<T>
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: EPiServer.Framework.Dependencies
Assembly: EPiServer.Framework.dll
Version: 8.11.0
Syntax
public class DependencySorter<T>
Type Parameters
Name Description
T
Remarks

This class is thread safe.

Constructors

DependencySorter()

Declaration
public DependencySorter()

Methods

Sort(IEnumerable<T>, Func<T, IEnumerable<T>>)

Sorts specified items by dependencies.

Declaration
public IList<T> Sort(IEnumerable<T> items, Func<T, IEnumerable<T>> getDependenciesDelegate)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<T> items

The items.

System.Func<T, System.Collections.Generic.IEnumerable<T>> getDependenciesDelegate

The deledate to get item dependencies.

Returns
Type Description
System.Collections.Generic.IList<T>
Exceptions
Type Condition
DependencyCycleException

Thrown when dependency cycle is detected.

Sort(IEnumerable<T>, Func<T, IEnumerable<T>>, Boolean)

Sorts specified items by dependencies.

Declaration
public IList<T> Sort(IEnumerable<T> items, Func<T, IEnumerable<T>> getDependenciesDelegate, bool throwOnCycle)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<T> items

The collection of items that should be sorted by dependencies.

System.Func<T, System.Collections.Generic.IEnumerable<T>> getDependenciesDelegate

The deledate to get item dependencies.

System.Boolean throwOnCycle

if set to true throw exception when dependency cycle is detected.

Returns
Type Description
System.Collections.Generic.IList<T>