[]
This method extends the LINQ methods to flatten a collection of items that have a property of children of the same type.
public static IEnumerable<T> Flatten<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> childSelector)
| Type | Name | Description |
|---|---|---|
| IEnumerable<T> | source | Source collection. |
| Func<T, IEnumerable<T>> | childSelector | function that returns a collection of children for each item |
| Type | Description |
|---|---|
| IEnumerable<T> | Returns a one level list of elements of type T. |
| Name | Description |
|---|---|
| T | Item type |
This method extends the LINQ methods to obtain a single-level collection of descendants(is a collections) of an object of type T
public static IEnumerable<T> Flatten<T>(this T source, Func<T, IEnumerable<T>> childSelector)
| Type | Name | Description |
|---|---|---|
| T | source | The object of type T. |
| Func<T, IEnumerable<T>> | childSelector | function that returns a collection of children |
| Type | Description |
|---|---|
| IEnumerable<T> | Returns a one level list of elements of type T. |
| Name | Description |
|---|---|
| T | Item type. |
This method extends the LINQ methods to obtain a single-level collection of descendants(is an object) of an object of type T
public static IEnumerable<T> Flatten<T>(this T source, Func<T, T> childSelector)
| Type | Name | Description |
|---|---|---|
| T | source | The object of type T. |
| Func<T, T> | childSelector | function that returns of children object of type T. |
| Type | Description |
|---|---|
| IEnumerable<T> | Returns a one level list of elements of type T. |
| Name | Description |
|---|---|
| T | Item type. |