Show / Hide Table of Contents

Interface IObjectPool<T>

Minimal Pool interface. If you wanna to have more advanced pool management you can use PoolService<T>.

Namespace: Eco.Shared.Pools
Assembly: Eco.Shared.dll
Syntax
public interface IObjectPool<T>
    where T : class
Type Parameters
Name Description
T

Properties

Count

Current number of elements in pool.

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

Methods

Get()

Returns object from pool (if any) or null if pool is empty. It doesn't create new instance.

Declaration
T Get()
Returns
Type Description
T

TryAdd(T)

Tries to add obj to pool. If succeed then it returns true, otherwise (if pool is full or object is incompatible with pool) it will return false. You can handle return value for final object cleanup.

Declaration
bool TryAdd(T obj)
Parameters
Type Name Description
T obj
Returns
Type Description
System.Boolean

Extension Methods

ObjectPoolExtensions.AsService<T>(IObjectPool<T>, Func<T>, Action<T>)
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
☀
☾