comparison Implab/Safe.cs @ 177:a0ff6a0e9c44 ref20160224

refactoring
author cin
date Wed, 23 Mar 2016 01:42:00 +0300
parents 2a8466f0cb8a
children 4d9830a9bbb8
comparison
equal deleted inserted replaced
176:0c3c69fe225b 177:a0ff6a0e9c44
37 } 37 }
38 38
39 public static void ArgumentInRange(int value, int min, int max, string paramName) { 39 public static void ArgumentInRange(int value, int min, int max, string paramName) {
40 if (value < min || value > max) 40 if (value < min || value > max)
41 throw new ArgumentOutOfRangeException(paramName); 41 throw new ArgumentOutOfRangeException(paramName);
42 }
43
44 public static void ArgumentOfType(object value, Type type, string paramName) {
45 if (!type.IsInstanceOfType(value))
46 throw new ArgumentException(String.Format("The parameter must be of type {0}", type), paramName);
42 } 47 }
43 48
44 public static void Dispose(params IDisposable[] objects) { 49 public static void Dispose(params IDisposable[] objects) {
45 foreach (var d in objects) 50 foreach (var d in objects)
46 if (d != null) 51 if (d != null)