Exemplo n.º 1
0
 /// <summary>
 /// Index property for storing items in the resource pool
 /// </summary>
 public IDisposable this[object key]
 {
     get
     {
         if (Check(key))
         {
             return(_Pool.GetResource(key));
         }
         else
         {
             return(null);
         }
     }
     set
     {
         _Pool.SetResource(key, value);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Stores item in the 2 level resource pool
 /// </summary>
 /// <param name="container">Name of the container resource pool</param>
 /// <param name="item">Name of the item</param>
 /// <param name="resource">The resource to store</param>
 public void Set(object container, object item, IDisposable resource)
 {
     if (_Pool.CheckResource(container))
     {
         ResourcePool containerPool = (ResourcePool)_Pool.GetResource(container);
         containerPool.SetResource(item, resource);
     }
     else
     {
         ResourcePool containerPool = new ResourcePool();
         _Pool.SetResource(container, containerPool);
         containerPool.SetResource(item, resource);
     }
 }