view Implab/ObjectPoolWrapper.cs @ 85:abe260860bd6 v2

fixed JSONXmlReader disposing under ugly mono ObjectPool is made abstract
author cin
date Tue, 30 Sep 2014 16:05:35 +0400
parents 34bb2f32634d
children
line wrap: on
line source

using System;

namespace Implab {
    public class ObjectPoolWrapper<T> : IDisposable {
        readonly T m_value;
        readonly ObjectPool<T> m_pool;

        internal ObjectPoolWrapper(T value, ObjectPool<T> pool) {
            m_value = value;
            m_pool = pool;
        }

        public T Value {
            get { return m_value; }
        }

        #region IDisposable implementation
        public void Dispose() {
            m_pool.Release(m_value);
        }
        #endregion
    }
}