Mercurial > pub > ImplabNet
annotate Implab/Safe.cs @ 11:6ec82bf68c8e promises
refactoring
| author | cin |
|---|---|
| date | Tue, 05 Nov 2013 01:09:58 +0400 |
| parents | aa367305156b |
| children | dafaadca5b9f |
| rev | line source |
|---|---|
| 1 | 1 using System; |
| 2 using System.Collections.Generic; | |
| 3 using System.Linq; | |
| 4 using System.Text; | |
| 5 | |
| 6 namespace Implab | |
| 7 { | |
| 8 public static class Safe | |
| 9 { | |
| 2 | 10 public static void Dispose<T>(ref T obj) where T : class |
| 1 | 11 { |
| 2 | 12 var disp = obj as IDisposable; |
| 13 if (disp != null) | |
| 1 | 14 { |
| 2 | 15 disp.Dispose(); |
| 1 | 16 obj = default(T); |
| 17 } | |
| 18 } | |
| 19 } | |
| 20 } |
