diff Implab/Safe.cs @ 177:a0ff6a0e9c44 ref20160224

refactoring
author cin
date Wed, 23 Mar 2016 01:42:00 +0300
parents 2a8466f0cb8a
children 4d9830a9bbb8
line wrap: on
line diff
--- a/Implab/Safe.cs	Tue Mar 22 18:58:40 2016 +0300
+++ b/Implab/Safe.cs	Wed Mar 23 01:42:00 2016 +0300
@@ -41,6 +41,11 @@
                 throw new ArgumentOutOfRangeException(paramName);
         }
 
+        public static void ArgumentOfType(object value, Type type, string paramName) {
+            if (!type.IsInstanceOfType(value))
+                throw new ArgumentException(String.Format("The parameter must be of type {0}", type), paramName);
+        }
+
         public static void Dispose(params IDisposable[] objects) {
             foreach (var d in objects)
                 if (d != null)