Ejemplo n.º 1
0
        /// <summary>
        /// Dispose the instance
        /// </summary>
        /// <param name="keepAliveItem">don't dispose this item</param>
        public void Dispose(T keepAliveItem)
        {
            foreach (IDisposable item in this)
            {
                if (item.Equals(keepAliveItem))
                {
                    continue;
                }

                ICOMObjectDisposable disposeItem = item as ICOMObjectDisposable;
                if (null != disposeItem)
                {
                    try
                    {
                        if (false == disposeItem.IsDisposed && false == disposeItem.IsDisposed)
                        {
                            disposeItem.Dispose();
                        }
                    }
                    catch
                    {
                        ;
                    }
                }
                else
                {
                    item.Dispose();
                }
            }
            Clear();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Dispose the instance
        /// </summary>
        public void Dispose()
        {
            foreach (object item in this)
            {
                ICOMObjectDisposable disposeItem = item as ICOMObjectDisposable;
                if (null != disposeItem)
                {
                    try
                    {
                        if (false == disposeItem.IsDisposed && false == disposeItem.IsDisposed)
                        {
                            disposeItem.Dispose();
                        }
                    }
                    catch
                    {
                        ;
                    }
                }

                if (item is MarshalByRefObject)
                {
                    try
                    {
                        Marshal.ReleaseComObject(item);
                    }
                    catch
                    {
                        ;
                    }
                }
            }
            Clear();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Dispose the instance
 /// </summary>
 /// <param name="keepAliveItem">don't dispose this item</param>
 public void Dispose(T keepAliveItem)
 {
     foreach (T item in this)
     {
         ICOMObjectDisposable disposeItem = item as ICOMObjectDisposable;
         if (null != disposeItem && object.ReferenceEquals(item, keepAliveItem))
         {
             if (false == disposeItem.IsDisposed && false == disposeItem.IsDisposed)
             {
                 disposeItem.Dispose();
             }
         }
     }
     _items = new T[0];
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Dispose the instance
 /// </summary>
 public void Dispose()
 {
     foreach (object item in this)
     {
         ICOMObjectDisposable disposeItem = item as ICOMObjectDisposable;
         if (null != disposeItem)
         {
             if (false == disposeItem.IsDisposed && false == disposeItem.IsDisposed)
             {
                 disposeItem.Dispose();
             }
         }
     }
     _items = new T[0];
 }