Class PoolableListWrapper<T>
Inheritance
System.Object
PoolableListWrapper<T>
Assembly: Eco.Shared.dll
Syntax
public class PoolableListWrapper<T> : Object
Type Parameters
Constructors
PoolableListWrapper()
Declaration
public PoolableListWrapper()
PoolableListWrapper(ListPool<T>)
Declaration
public PoolableListWrapper(ListPool<T> pool)
Parameters
Properties
Count
Declaration
public int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
Add(T)
Declaration
Parameters
Type |
Name |
Description |
T |
item |
|
AddRange(ICollection<T>)
Declaration
public void AddRange(ICollection<T> range)
Parameters
Type |
Name |
Description |
System.Collections.Generic.ICollection<T> |
range |
|
Clear()
Declaration
Contains(T)
Declaration
public bool Contains(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Type |
Description |
System.Boolean |
|
GetEnumerator()
Declaration
public List<T>.Enumerator GetEnumerator()
Returns
Type |
Description |
System.Collections.Generic.List.Enumerator<> |
|
GetUnsafeListSnapshot()
Returns unsafe list snapshot which may be directly accessed with System.Collections.Generic.List<> API.
This list only safe to use before any modification operation like Clear() etc.
Also you should guarantee this list won't exceed current System.Collections.Generic.List`1.Capacity otherwise it may lead to unexpected behavior (including exceptions).
Declaration
public List<T> GetUnsafeListSnapshot()
Returns
Type |
Description |
System.Collections.Generic.List<T> |
Current snapshot reference. It may be null if Capacity == 0.
|
GetUnsafeListSnapshot(Int32)
Declaration
public List<T> GetUnsafeListSnapshot(int minimalCapacity)
Parameters
Type |
Name |
Description |
System.Int32 |
minimalCapacity |
minimal required capacity for snapshot.
|
Returns
Type |
Description |
System.Collections.Generic.List<T> |
Current snapshot reference. It may be null if Capacity == 0.
|
Remove(T)
Declaration
public bool Remove(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Type |
Description |
System.Boolean |
|
RentSnapshotAndClear()
Returns current list snapshot and clear poolable list wrapper.
Declaration
public List<T> RentSnapshotAndClear()
Returns
Type |
Description |
System.Collections.Generic.List<T> |
Current snapshot. It may be null if Capacity == 0.
|
RentSnapshotAndClear(out List<T>)
Outputs current list snapshot in snapshot
and clear poolable list wrapper. Returns a promise which should be disposed to return a list back to pool.
Declaration
public Nullable<ListPool<T>.ReturnPromise> RentSnapshotAndClear(out List<T> snapshot)
Parameters
Type |
Name |
Description |
System.Collections.Generic.List<T> |
snapshot |
|
Returns
ReturnSnapshot(List<T>)
Return previously rented snapshot (see RentSnapshotAndClear()).
This method is thread-safe. Usual case you rent list in thread-unsafe content and then return it in another thread.
Declaration
public void ReturnSnapshot(List<T> snapshot)
Parameters
Type |
Name |
Description |
System.Collections.Generic.List<T> |
snapshot |
|
Extension Methods