//================================================================================================== /// <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); }
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); }