Mercurial > pub > ImplabNet
comparison Implab/Safe.cs @ 31:dafaadca5b9f
minor cleanup
author | cin |
---|---|
date | Mon, 07 Apr 2014 18:17:00 +0400 |
parents | aa367305156b |
children | 2c332a9c64c0 |
comparison
equal
deleted
inserted
replaced
30:2fad2d1f4b03 | 31:dafaadca5b9f |
---|---|
5 | 5 |
6 namespace Implab | 6 namespace Implab |
7 { | 7 { |
8 public static class Safe | 8 public static class Safe |
9 { | 9 { |
10 public static void Dispose<T>(ref T obj) where T : class | 10 public static void Dispose<T>(T obj) where T : class |
11 { | 11 { |
12 var disp = obj as IDisposable; | 12 var disp = obj as IDisposable; |
13 if (disp != null) | 13 if (disp != null) |
14 { | |
15 disp.Dispose(); | 14 disp.Dispose(); |
16 obj = default(T); | |
17 } | |
18 } | 15 } |
19 } | 16 } |
20 } | 17 } |