Show / Hide Table of Contents

Class PoolableListWrapper<T>

Inheritance
System.Object
PoolableListWrapper<T>
Namespace: Eco.Shared.Pools.Collections
Assembly: Eco.Shared.dll
Syntax
public class PoolableListWrapper<T> : Object
Type Parameters
Name Description
T

Constructors

PoolableListWrapper()

Declaration
public PoolableListWrapper()

PoolableListWrapper(ListPool<T>)

Declaration
public PoolableListWrapper(ListPool<T> pool)
Parameters
Type Name Description
ListPool<T> pool

Properties

Count

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32

Methods

Add(T)

Declaration
public void Add(T item)
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
public void Clear()

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)

Same as GetUnsafeListSnapshot(), but ensures required capacity.

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
Type Description
System.Nullable<ListPool.ReturnPromise<>>

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

CommandLine.FeedFromCommandLine(Object)
CommandLine.ToCommandLineArgs(Object, Func<Object, Boolean>)
ListUtil.DepthFirstTraversal<T>(T, Func<T, IEnumerable<T>>)
EnumerableExtensions.SingleItemAsEnumerable<T>(T)
EventUtils.RaiseEvent<TEventArgs>(Object, String, TEventArgs)
PredicateUtils.MatchesAll<TEnumerable, T>(T, TEnumerable)
PredicateUtils.MatchesAll<T>(T, Func<T, Boolean>[])
PredicateUtils.MatchesAny<TEnumerable, T>(T, TEnumerable)
ReflectionUtils.PropertyValue<T>(Object, PropertyInfo)
ReflectionUtils.TryGetPropertyValueByName<T>(Object, String, out T)
ReflectionUtils.GetPropertyValueByName<T>(Object, String)
ReflectionUtils.SetPropertyByName(Object, String, Object)
ReflectionUtils.GetStructPropertyByName<T>(Object, String)
ReflectionUtils.GetStringPropertyByName(Object, String)
ReflectionUtils.ZipByProperty<T>(Object, Object, Object, Func<T, T, T>)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾