AdvantageCMS.Core.Common.BaseClasses Namespace
Advantage CSP

HierarchyExtensions..::..CreateHierarchy<(Of <(<'TItem, TId>)>)> Method (IEnumerable<(Of <(<'TItem>)>)>, Func<(Of <(<'TItem, TId>)>)>, Func<(Of <(<'TItem, TId>)>)>)

Creates the hierarchy.

Namespace:  AdvantageCSP.Core.HierarchicalList
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public static IEnumerable<IHierarchicalListItem<TItem>> CreateHierarchy<TItem, TId>(
	this IEnumerable<TItem> flatList,
	Func<TItem, TId> idSelector,
	Func<TItem, TId> parentIdSelector
)

Type Parameters

TItem
The type of the t item.
TId
The type of the t identifier.

Parameters

flatList
Type: IEnumerable<(Of <(<'TItem>)>)>
The flat list.
idSelector
Type: Func<(Of <(<'TItem, TId>)>)>
The identifier selector.
parentIdSelector
Type: Func<(Of <(<'TItem, TId>)>)>
The parent identifier selector.

Return Value

IEnumerable<IHierarchicalListItem<TItem>>.

Examples


Example of retrieving Navigations setting the parent/child items

C#
var ds1= GetNavigations(eNavigationSelector.VisibleInMenu).CreateHierarchyList(t =>t.ID, t =>t.ParentID);