Mercurial > pub > ImplabNet
comparison Implab/Safe.cs @ 90:efcb076407a7 v2
code cleanup
author | cin |
---|---|
date | Sun, 12 Oct 2014 16:50:34 +0400 |
parents | 790e8a997d30 |
children | a43745f81f10 |
comparison
equal
deleted
inserted
replaced
89:ce0171cacec4 | 90:efcb076407a7 |
---|---|
11 { | 11 { |
12 public static void ArgumentMatch(string param, string name, Regex rx) { | 12 public static void ArgumentMatch(string param, string name, Regex rx) { |
13 if (rx == null) | 13 if (rx == null) |
14 throw new ArgumentNullException("rx"); | 14 throw new ArgumentNullException("rx"); |
15 if (!rx.IsMatch(param)) | 15 if (!rx.IsMatch(param)) |
16 throw new ArgumentException(String.Format("A prameter value must match {0}", rx), name); | 16 throw new ArgumentException(String.Format("The prameter value must match {0}", rx), name); |
17 } | 17 } |
18 | 18 |
19 public static void ArgumentNotEmpty(string param, string name) { | 19 public static void ArgumentNotEmpty(string param, string name) { |
20 if (String.IsNullOrEmpty(param)) | 20 if (String.IsNullOrEmpty(param)) |
21 throw new ArgumentException("A parameter can't be empty", name); | 21 throw new ArgumentException("The parameter can't be empty", name); |
22 } | |
23 | |
24 public static void ArgumentNotEmpty<T>(T[] param, string name) { | |
25 if (param == null || param.Length == 0) | |
26 throw new ArgumentException("The array must be not emty"); | |
22 } | 27 } |
23 | 28 |
24 public static void ArgumentNotNull(object param, string name) { | 29 public static void ArgumentNotNull(object param, string name) { |
25 if (param == null) | 30 if (param == null) |
26 throw new ArgumentNullException(name); | 31 throw new ArgumentNullException(name); |