Beispiel #1
0
 /// <summary>
 /// Call the dispose method if the object is not null and was not already disposed
 /// </summary>
 /// <param name="obj"></param>
 public static void SafeDispose(this IDisposed obj)
 {
     if (obj != null && !obj.Disposed)
     {
         obj.Dispose();
     }
 }
Beispiel #2
0
 public static void CheckDisposed(this IDisposed dispose)
 {
     if (false.Equals(object.ReferenceEquals(dispose, null)) && dispose.IsDisposed)
     {
         throw new System.ObjectDisposedException("IDisposedExtensions.CheckDisposed,true");
     }
 }
Beispiel #3
0
 public static void CheckDisposed(this IDisposed dispose)
 {
     if (dispose != null && dispose.IsDisposed)
     {
         throw new System.ObjectDisposedException("IDisposedExtensions.CheckDisposed,true");
     }
 }
Beispiel #4
0
 public static bool ShouldDisposed(this IDisposed dispose)
 {
     return(false.Equals(object.ReferenceEquals(dispose, null)) && dispose.ShouldDispose);
 }
Beispiel #5
0
 public static bool IsNullOrDisposed(this IDisposed dispose)
 {
     return(object.ReferenceEquals(dispose, null) || dispose.IsDisposed);
 }
 public ArgumentNullOrDisposedException(string paramName, IDisposed what)
     : this(paramName)
 {
     Disposed = what;
 }
 public ArgumentNullOrDisposedException(IDisposed what) : this(string.Empty, what)
 {
 }
 public ArgumentNullOrDisposedException(string paramName, IDisposed what, int stackFrameDepth, bool fNeedFileInfo)
 {
     //Warning, memory consumption...
     StackFrame = new System.Diagnostics.StackFrame(stackFrameDepth, fNeedFileInfo);
 }
Beispiel #9
0
 public static bool ShouldDisposed(this IDisposed dispose)
 {
     return(dispose != null && dispose.ShouldDispose);
 }
Beispiel #10
0
 public static bool IsNullOrDisposed(this IDisposed dispose)
 {
     return(null == dispose || dispose.IsDisposed);
 }
Beispiel #11
0
 public LinkedDisposableWrapper(IDisposed linkTo, TValue value)
     : base(linkTo, value)
 {
 }