ItemTreeBuildExtensionsBuildTNode, TItem, TSNode(TNode, TSNode, FuncTSNode, IReadOnlyListTSNode, FuncTSNode, TItem, Int32) Method

Build tree from parent/root node using arbitrary hierarchical source. Uses functions to retrieve source children and map items.

Definition

Namespace: MobileTrack.Common.Models.TreeViews.ItemTree
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.7+45c8d9adb5970d727cceec44a5ed61aea0016e50
public static void Build<TNode, TItem, TSNode>(
	this TNode parent,
	TSNode sourceParent,
	Func<TSNode, IReadOnlyList<TSNode>> getChildren,
	Func<TSNode, TItem> mapToItem,
	int maxRelativeDepth = 2147483647
)
where TNode : ItemTreeNode<TNode, TItem>
where TItem : IIdLabel

Parameters

parent  TNode
Parent/root destination node
sourceParent  TSNode
Source hierarchical parent/root object
getChildren  FuncTSNode, IReadOnlyListTSNode
Get children from source object
mapToItem  FuncTSNode, TItem
Map source object to item
maxRelativeDepth  Int32  (Optional)
Max depth of traversal (relative to this node)

Type Parameters

TNode
Node type
TItem
Business object type in the collection, derived from IIdLabel
TSNode
Node type of the source parent

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type TNode. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also