annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
1 using System;
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
2 using System.Collections.Generic;
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
3 using System.Linq;
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
4 using System.Text;
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
5
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
6 namespace Implab
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
7 {
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
8 public static class Safe
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
9 {
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
10 public static void Dispose<T>(ref T obj) where T : IDisposable
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
11 {
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
12 if (obj != null)
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
13 {
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
14 obj.Dispose();
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
15 obj = default(T);
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
16 }
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
17 }
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
18 }
6fb3b01ee971 Added utility class for safe disposing methods.
cin
parents:
diff changeset
19 }