Mercurial > pub > ImplabNet
comparison Implab/Safe.cs @ 161:2a8466f0cb8a v2
DFA refactoring
author | cin |
---|---|
date | Fri, 19 Feb 2016 18:07:17 +0300 |
parents | 706fccb85524 |
children | a0ff6a0e9c44 |
comparison
equal
deleted
inserted
replaced
160:5802131432e4 | 161:2a8466f0cb8a |
---|---|
7 | 7 |
8 namespace Implab | 8 namespace Implab |
9 { | 9 { |
10 public static class Safe | 10 public static class Safe |
11 { | 11 { |
12 public static void ArgumentAssert(bool condition, string paramName) { | |
13 if (!condition) | |
14 throw new ArgumentException("The parameter is invalid", paramName); | |
15 } | |
16 | |
12 public static void ArgumentMatch(string value, string paramName, Regex rx) { | 17 public static void ArgumentMatch(string value, string paramName, Regex rx) { |
13 if (rx == null) | 18 if (rx == null) |
14 throw new ArgumentNullException("rx"); | 19 throw new ArgumentNullException("rx"); |
15 if (!rx.IsMatch(value)) | 20 if (!rx.IsMatch(value)) |
16 throw new ArgumentException(String.Format("The prameter value must match {0}", rx), paramName); | 21 throw new ArgumentException(String.Format("The prameter value must match {0}", rx), paramName); |