Table of Contents

Class TreeItemPool<T, TModel>

Namespace
Loehnert.Lisrt.TypeAndResult.VisualTreeHelpers
Assembly
Loehnert.Lisrt.TypeAndResult.dll

Represents a recycling pool for TreeItemBase<TModel>.

public class TreeItemPool<T, TModel> where T : TreeItemBase<TModel> where TModel : class

Type Parameters

T

TreeItem type.

TModel

TreeItem model type.

Inheritance
TreeItemPool<T, TModel>
Inherited Members

Constructors

TreeItemPool(Func<T>)

Initializes a new instance of the TreeItemPool<T, TModel> class.

public TreeItemPool(Func<T> factoryFunction)

Parameters

factoryFunction Func<T>

Factory function for a new T.

Methods

Pop(ITreeItem, TModel)

Pops a recycled or new T by the factory Function. Model and parent will be set.

public T Pop(ITreeItem parent, TModel model)

Parameters

parent ITreeItem

Parent of the TreeItemBase<TModel>.

model TModel

Model for the TreeItemBase<TModel>.

Returns

T

A TreeItemBase<TModel> of type T with the given model and parent.

Push(T)

Pushes the item back into the pool. Resets the Model and Parent to null.

public void Push(T item)

Parameters

item T

Item to push.

Exceptions

ArgumentNullException

Thrown when item is null.