Table of Contents

Class TreeTraversal

Namespace
ICSharpCode.Decompiler.Util
Assembly
ICSharpCode.Decompiler.dll

Static helper methods for traversing trees.

public static class TreeTraversal
Inheritance
TreeTraversal
Inherited Members

Methods

PostOrder<T>(IEnumerable<T>, Func<T, IEnumerable<T>?>)

Converts a tree data structure into a flat list by traversing it in post-order.

public static IEnumerable<T> PostOrder<T>(IEnumerable<T> input, Func<T, IEnumerable<T>?> recursion)

Parameters

input IEnumerable<T>

The root elements of the forest.

recursion Func<T, IEnumerable<T>>

The function that gets the children of an element.

Returns

IEnumerable<T>

Iterator that enumerates the tree structure in post-order.

Type Parameters

T

PostOrder<T>(T, Func<T, IEnumerable<T>?>)

Converts a tree data structure into a flat list by traversing it in post-order.

public static IEnumerable<T> PostOrder<T>(T root, Func<T, IEnumerable<T>?> recursion)

Parameters

root T

The root element of the tree.

recursion Func<T, IEnumerable<T>>

The function that gets the children of an element.

Returns

IEnumerable<T>

Iterator that enumerates the tree structure in post-order.

Type Parameters

T

PreOrder<T>(IEnumerable<T>, Func<T, IEnumerable<T>?>)

Converts a tree data structure into a flat list by traversing it in pre-order.

public static IEnumerable<T> PreOrder<T>(IEnumerable<T> input, Func<T, IEnumerable<T>?> recursion)

Parameters

input IEnumerable<T>

The root elements of the forest.

recursion Func<T, IEnumerable<T>>

The function that gets the children of an element.

Returns

IEnumerable<T>

Iterator that enumerates the tree structure in pre-order.

Type Parameters

T

PreOrder<T>(T, Func<T, IEnumerable<T>?>)

Converts a tree data structure into a flat list by traversing it in pre-order.

public static IEnumerable<T> PreOrder<T>(T root, Func<T, IEnumerable<T>?> recursion)

Parameters

root T

The root element of the tree.

recursion Func<T, IEnumerable<T>>

The function that gets the children of an element.

Returns

IEnumerable<T>

Iterator that enumerates the tree structure in pre-order.

Type Parameters

T