AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

HierarchyConverter..::..ToHierarchicalModelList<(Of <(<'T>)>)> Method

Wraps each model in the collection with a [HierarchyData{T}] adapter and returns them as a [HierarchicalModelList] that implements [IHierarchicalEnumerable]. The resulting list can be used directly as the data source for WebForms tree-bound controls, or is used internally by [HierarchicalModelDataSource{T}.GetHierarchicalView] and [HierarchyData{T}.GetChildren].

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

Syntax


public static HierarchicalModelList ToHierarchicalModelList<T>(
	this IEnumerable<T> modelWithHierarchy
)
where T : IModelWithHierarchy<T>

Type Parameters

T
A model type implementing [IModelWithHierarchy{T}] (e.g., a Navigation node with Parent/Children references already populated).

Parameters

modelWithHierarchy
Type: IEnumerable<(Of <(<'T>)>)>
The collection of hierarchy-aware models to convert. Each model's [IModelWithHierarchy{T}.Children] and [IModelWithHierarchy{T}.Parent] should already be populated before calling this method.

Return Value

A [HierarchicalModelList] containing one [HierarchyData{T}] wrapper per input model, ready for hierarchical data binding.