diff Implab/Safe.cs @ 2:aa367305156b

small fixes
author cin
date Thu, 29 Aug 2013 17:03:44 +0400
parents 6fb3b01ee971
children dafaadca5b9f
line wrap: on
line diff
--- a/Implab/Safe.cs	Tue Aug 27 08:28:42 2013 +0400
+++ b/Implab/Safe.cs	Thu Aug 29 17:03:44 2013 +0400
@@ -7,11 +7,12 @@
 {
     public static class Safe
     {
-        public static void Dispose<T>(ref T obj) where T : IDisposable
+        public static void Dispose<T>(ref T obj) where T : class
         {
-            if (obj != null)
+            var disp = obj as IDisposable;
+            if (disp != null)
             {
-                obj.Dispose();
+                disp.Dispose();
                 obj = default(T);
             }
         }