Class ListPoolPolicy<T>
- Namespace
- RichHudFramework
- Assembly
- RichHudClient.dll
IPooledObjectPolicy<T> implementation specialized for List<T>. Reuses lists by calling Clear() instead of allocating new ones.
public class ListPoolPolicy<T> : IPooledObjectPolicy<List<T>>
Type Parameters
T
- Inheritance
-
ListPoolPolicy<T>
- Implements
Methods
GetNewObject()
Creates a fresh instance of System.Collections.Generic.List{`0}.
public List<T> GetNewObject()
Returns
- List<T>
GetNewPool()
Convenience factory returning a pool pre-configured with this policy.
public static ObjectPool<List<T>> GetNewPool()
Returns
- ObjectPool<List<T>>
ResetObject(List<T>)
Prepares a used object for reuse (e.g. clears state, unsubscribes events). Called immediately before the object is returned to the pool.
public void ResetObject(List<T> list)
Parameters
listList<T>
ResetRange(IReadOnlyList<List<T>>, int, int)
Resets a contiguous range of pooled objects in a list.
public void ResetRange(IReadOnlyList<List<T>> lists, int index, int count)
Parameters
listsIReadOnlyList<List<T>>indexintcountint
ResetRange<T2>(IReadOnlyList<MyTuple<List<T>, T2>>, int, int)
Resets the contiguous range of pooled objects in a list of tuples.
public void ResetRange<T2>(IReadOnlyList<MyTuple<List<T>, T2>> lists, int index, int count)
Parameters
listsIReadOnlyList<MyTuple<List<T>, T2>>indexintcountint
Type Parameters
T2