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
ITreeItemParent of the TreeItemBase<TModel>.
model
TModelModel for the TreeItemBase<TModel>.
Returns
- T
A TreeItemBase<TModel> of type
T
with the given model and parent.
Push(T)
public void Push(T item)
Parameters
item
TItem to push.
Exceptions
- ArgumentNullException
Thrown when
item
is null.