Ejemplo n.º 1
0
//==================================================================================================

/// <exception cref="Exception" />
        public static bool Free <T>(ref T disposableVar) where T : class, IDisposable
        {
            if (disposableVar != null)
            {
                HOps.NullExchange(ref disposableVar).Dispose();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
 public static bool TryFree <T>(ref T disposableVar, out Exception err) where T : class, IDisposable
 {
     if (disposableVar != null)
     {
         try {
             HOps.NullExchange(ref disposableVar).Dispose();
         }
         catch (Exception e) {
             err = e; return(false);
         }
     }
     err = null; return(true);
 }