Beispiel #1
0
        internal static void EnsureNotDisposed(
            this SDX.DisposeBase disposeBase, string checkedVariableName,
            [CallerMemberName]
            string callerMethod = "")
        {
            if (string.IsNullOrEmpty(callerMethod))
            {
                callerMethod = "Unknown";
            }

            if (disposeBase.IsDisposed)
            {
                throw new SeeingSharpCheckException(string.Format(
                                                        "Resource {0} within method {1} musst not be disposed!",
                                                        checkedVariableName, callerMethod));
            }
        }
 void SafeDispose(DisposeBase disposableObj)
 {
     if (disposableObj != null)
         disposableObj.Dispose();
 }
Beispiel #3
0
 public static void SafeDispose(DisposeBase disposable)
 {
     if (disposable != null && !disposable.IsDisposed)
     {
         disposable.Dispose();
     }
 }