Mercurial > pub > ImplabNet
annotate Implab/ObjectPoolWrapper.cs @ 86:b33832ab0262 v2
ServiceLocator: added a cleanup callback to the service registration method
| author | cin |
|---|---|
| date | Mon, 06 Oct 2014 03:41:17 +0400 |
| parents | 34bb2f32634d |
| children |
| rev | line source |
|---|---|
| 82 | 1 using System; |
| 2 | |
| 3 namespace Implab { | |
| 84 | 4 public class ObjectPoolWrapper<T> : IDisposable { |
| 82 | 5 readonly T m_value; |
| 6 readonly ObjectPool<T> m_pool; | |
| 7 | |
| 8 internal ObjectPoolWrapper(T value, ObjectPool<T> pool) { | |
| 9 m_value = value; | |
| 10 m_pool = pool; | |
| 11 } | |
| 12 | |
| 13 public T Value { | |
| 14 get { return m_value; } | |
| 15 } | |
| 16 | |
| 17 #region IDisposable implementation | |
| 18 public void Dispose() { | |
| 19 m_pool.Release(m_value); | |
| 20 } | |
| 21 #endregion | |
| 22 } | |
| 23 } | |
| 24 |
