Search Results for

Show / Hide Table of Contents

# Class DelegateTreeBuilder<T>

Implementation of ITreeBuilder<T> that uses user defined functions

##### Inheritance

System.Object
TreeBuilder<T>
DelegateTreeBuilder<T>

##### Implements

ITreeBuilder<T>

##### Inherited Members

TreeBuilder<T>.SupportsCanExpand
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace: Terminal.Gui.Trees

###### Assembly: Terminal.Gui.dll

##### Syntax

    public class DelegateTreeBuilder<T> : TreeBuilder<T>, ITreeBuilder<T>

##### Type Parameters

Name | Description
--- | ---
T |

### Constructors

#### DelegateTreeBuilder(Func<T, IEnumerable<T>>)

Constructs an implementation of ITreeBuilder<T> that calls the user defined method `childGetter` to determine children

##### Declaration

    public DelegateTreeBuilder(Func<T, IEnumerable<T>> childGetter)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<T, System.Collections.Generic.IEnumerable<T>> | childGetter |

#### DelegateTreeBuilder(Func<T, IEnumerable<T>>, Func<T, Boolean>)

Constructs an implementation of ITreeBuilder<T> that calls the user defined method `childGetter` to determine children and `canExpand` to determine expandability

##### Declaration

    public DelegateTreeBuilder(Func<T, IEnumerable<T>> childGetter, Func<T, bool> canExpand)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<T, System.Collections.Generic.IEnumerable<T>> | childGetter |
System.Func<T, System.Boolean> | canExpand |

### Methods

#### CanExpand(T)

Returns whether a node can be expanded based on the delegate passed during construction

##### Declaration

    public override bool CanExpand(T toExpand)

##### Parameters

Type | Name | Description
--- | --- | ---
T | toExpand |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Overrides

Terminal.Gui.Trees.TreeBuilder<T>.CanExpand(T)

#### GetChildren(T)

Returns children using the delegate method passed during construction

##### Declaration

    public override IEnumerable<T> GetChildren(T forObject)

##### Parameters

Type | Name | Description
--- | --- | ---
T | forObject |

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IEnumerable<T> |

##### Overrides

Terminal.Gui.Trees.TreeBuilder<T>.GetChildren(T)

### Implements

ITreeBuilder<T>