Back to Devexpress

EnumerableExtensions.Flatten<T>(IEnumerable<T>, Func<T, Int32, IEnumerable<T>>) Method

maui-devexpress-dot-maui-dot-mvvm-dot-enumerableextensions-dot-flatten-1-x28-system-dot-collections-dot-generic-dot-ienumerable-0-system-dot-func-0-system-dot-int32-system-dot-collections-dot-generic-dot-ienumerable-0-x29.md

latest1.9 KB
Original Source

EnumerableExtensions.Flatten<T>(IEnumerable<T>, Func<T, Int32, IEnumerable<T>>) Method

Converts a hierarchical data structure into a flat collection. This method traverses the hierarchy defined by the getItems() function. The function accepts an item in the hierarchy and the hierarchy level, and returns nested items.

Namespace : DevExpress.Maui.Mvvm

Assembly : DevExpress.Maui.Mvvm.dll

NuGet Package : DevExpress.Maui.Mvvm

Declaration

csharp
public static IEnumerable<T> Flatten<T>(
    this IEnumerable<T> source,
    Func<T, int, IEnumerable<T>> getItems
)

Parameters

NameTypeDescription
sourceIEnumerable<T>

The source collection that contains the root items of the hierarchy data structure.

| | getItems | Func<T, Int32, IEnumerable<T>> |

The function that invokes for each item in the source collection and retrieves nested items. The function accepts an item in the hierarchy and the hierarchy level, and returns nested items.

|

Type Parameters

NameDescription
T

The type of items stored in the source collection.

|

Returns

TypeDescription
IEnumerable<T>

The flat collection of items.

|

See Also

EnumerableExtensions Class

EnumerableExtensions Members

DevExpress.Maui.Mvvm Namespace