Show / Hide Table of Contents

Class FixedSizePool<T>

Implementation of ThreadSafeFixedSizePool<T> with extended functionality. Obsolete, should be replaced with PoolService<T> when all functionality will be supported.

Inheritance
System.Object
FixedSizePool<T>
Implements
IObjectPool<T>
Namespace: Eco.Shared.Pools
Assembly: Eco.Shared.dll
Syntax
public class FixedSizePool<T> : Object, IObjectPool<T> where T : class
Type Parameters
Name Description
T

Constructors

FixedSizePool(Int32, Boolean, Func<T>)

Declaration
public FixedSizePool(int poolSize, bool preAllocate, Func<T> elementConstructor)
Parameters
Type Name Description
System.Int32 poolSize
System.Boolean preAllocate
System.Func<T> elementConstructor

Properties

CacheHitPercent

Declaration
public float CacheHitPercent { get; }
Property Value
Type Description
System.Single

Count

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

PoolSize

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

Methods

Get()

Returns a object from the pool or null if no objects in the pool.

Declaration
public T Get()
Returns
Type Description
T

object from the pool or a new object.

TryAdd(T)

Tries to add object to the pool (if enough capacity in the pool).

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

Implements

IObjectPool<T>

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
☀
☾