diff Implab/Safe.cs @ 1:6fb3b01ee971

Added utility class for safe disposing methods. Added event fireing while promise is cancelled (needs some more work)
author cin
date Tue, 27 Aug 2013 08:28:42 +0400
parents
children aa367305156b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab/Safe.cs	Tue Aug 27 08:28:42 2013 +0400
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Implab
+{
+    public static class Safe
+    {
+        public static void Dispose<T>(ref T obj) where T : IDisposable
+        {
+            if (obj != null)
+            {
+                obj.Dispose();
+                obj = default(T);
+            }
+        }
+    }
+}