Mercurial > pub > ImplabNet
comparison Implab/Safe.cs @ 126:f7b2b8bfbb8c v2
minor changes
author | cin |
---|---|
date | Mon, 26 Jan 2015 02:12:01 +0300 |
parents | 62d2f1e98c4e |
children | 6241bff0cd64 |
comparison
equal
deleted
inserted
replaced
125:f803565868a4 | 126:f7b2b8bfbb8c |
---|---|
34 public static void ArgumentInRange(int value, int min, int max, string paramName) { | 34 public static void ArgumentInRange(int value, int min, int max, string paramName) { |
35 if (value < min || value > max) | 35 if (value < min || value > max) |
36 throw new ArgumentOutOfRangeException(paramName); | 36 throw new ArgumentOutOfRangeException(paramName); |
37 } | 37 } |
38 | 38 |
39 public static void Dispose<T>(T obj) where T : class | 39 public static void Dispose(params IDisposable[] objects) |
40 { | 40 { |
41 var disp = obj as IDisposable; | 41 foreach(var d in objects) |
42 if (disp != null) | 42 if (d != null) |
43 disp.Dispose(); | 43 d.Dispose(); |
44 } | 44 } |
45 | 45 |
46 [DebuggerStepThrough] | 46 [DebuggerStepThrough] |
47 public static IPromise<T> InvokePromise<T>(Func<T> action) { | 47 public static IPromise<T> InvokePromise<T>(Func<T> action) { |
48 ArgumentNotNull(action, "action"); | 48 ArgumentNotNull(action, "action"); |