Class TreeExtensions
Class TreeExtensions.
Inheritance
Namespace: ISynergy.Framework.Core.Extensions
Assembly: ISynergy.Framework.Core.dll
Syntax
public static class TreeExtensions : object
Methods
View SourceFindNode<TKey, TModel>(TreeNode<TKey, TModel>, TKey)
Finds the node.
Declaration
public static TreeNode<TKey, TModel> FindNode<TKey, TModel>(this TreeNode<TKey, TModel> node, TKey key)
where TKey : struct where TModel : class
Parameters
Type | Name | Description |
---|---|---|
TreeNode<TKey, TModel> | node | The node. |
TKey | key | The key. |
Returns
Type | Description |
---|---|
TreeNode<TKey, TModel> | TreeNode<TKey, TModel>. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the t key. |
TModel | The type of the t model. |
Flatten<TKey, TModel>(TreeNode<TKey, TModel>)
Flattens the specified node.
Declaration
public static IEnumerable<TreeNode<TKey, TModel>> Flatten<TKey, TModel>(this TreeNode<TKey, TModel> node)
where TKey : struct where TModel : class
Parameters
Type | Name | Description |
---|---|---|
TreeNode<TKey, TModel> | node | The node. |
Returns
Type | Description |
---|---|
IEnumerable<TreeNode<TKey, TModel>> | IEnumerable<ITreeNode>. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the t identifier. |
TModel | The type of the t model. |
FlattenAll<TKey, TModel>(TreeNode<TKey, TModel>)
Flattens all.
Declaration
public static IEnumerable<TreeNode<TKey, TModel>> FlattenAll<TKey, TModel>(this TreeNode<TKey, TModel> node)
where TKey : struct where TModel : class
Parameters
Type | Name | Description |
---|---|---|
TreeNode<TKey, TModel> | node | The node. |
Returns
Type | Description |
---|---|
IEnumerable<TreeNode<TKey, TModel>> | IEnumerable<TreeNode<TKey, TModel>>. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the t key. |
TModel | The type of the t model. |
FlattenDataList<TKey, TModel>(TreeNode<TKey, TModel>)
Flattens the values to list.
Declaration
public static IEnumerable<TModel> FlattenDataList<TKey, TModel>(this TreeNode<TKey, TModel> node)
where TKey : struct where TModel : class
Parameters
Type | Name | Description |
---|---|---|
TreeNode<TKey, TModel> | node | The tree. |
Returns
Type | Description |
---|---|
IEnumerable<TModel> | IEnumerable<System.Object>. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the t identifier. |
TModel | The type of the t model. |
FlattenList<TKey, TModel>(TreeNode<TKey, TModel>)
Flattens to list.
Declaration
public static IEnumerable<TreeNode<TKey, TModel>> FlattenList<TKey, TModel>(this TreeNode<TKey, TModel> node)
where TKey : struct where TModel : class
Parameters
Type | Name | Description |
---|---|---|
TreeNode<TKey, TModel> | node | The tree. |
Returns
Type | Description |
---|---|
IEnumerable<TreeNode<TKey, TModel>> | IEnumerable<ITreeNode>. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the t identifier. |
TModel | The type of the t model. |
GetNodeById<TKey, TModel>(IEnumerable<TreeNode<TKey, TModel>>, TKey)
Gets the node by identifier.
Declaration
public static TreeNode<TKey, TModel> GetNodeById<TKey, TModel>(this IEnumerable<TreeNode<TKey, TModel>> nodes, TKey key)
where TKey : struct where TModel : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TreeNode<TKey, TModel>> | nodes | The nodes. |
TKey | key | The identifier. |
Returns
Type | Description |
---|---|
TreeNode<TKey, TModel> | TreeNode<TKey, TModel>. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the t identifier. |
TModel | The type of the t model. |
GetRootNode<TKey, TModel>(TreeNode<TKey, TModel>)
Gets the root node.
Declaration
public static TreeNode<TKey, TModel> GetRootNode<TKey, TModel>(this TreeNode<TKey, TModel> node)
where TKey : struct where TModel : class
Parameters
Type | Name | Description |
---|---|---|
TreeNode<TKey, TModel> | node | The node. |
Returns
Type | Description |
---|---|
TreeNode<TKey, TModel> | TreeNode<TKey, TModel>. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the t key. |
TModel | The type of the t model. |
GetSelectedNode<TKey, TModel>(IEnumerable<TreeNode<TKey, TModel>>)
Gets the selected node.
Declaration
public static TreeNode<TKey, TModel> GetSelectedNode<TKey, TModel>(this IEnumerable<TreeNode<TKey, TModel>> nodes)
where TKey : struct where TModel : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TreeNode<TKey, TModel>> | nodes | The nodes. |
Returns
Type | Description |
---|---|
TreeNode<TKey, TModel> | TreeNode<TKey, TModel>. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the t identifier. |
TModel | The type of the t model. |
ToTree<TKey, TModel>(IEnumerable<TreeNode<TKey, TModel>>)
Converts to tree.
Declaration
public static TreeNode<TKey, TModel> ToTree<TKey, TModel>(this IEnumerable<TreeNode<TKey, TModel>> nodes)
where TKey : struct where TModel : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TreeNode<TKey, TModel>> | nodes | The data. |
Returns
Type | Description |
---|---|
TreeNode<TKey, TModel> | TreeNode<T>. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the t identifier. |
TModel | The type of the t model. |