public static ArgumentPropertyValue <string> StartsWith(this ArgumentPropertyValue <string> item, string pattern) { if (!item.Value.StartsWith(pattern)) { throw new ArgumentException(string.Format("Parameter {0} must start with {1}", item.Name, pattern)); } return(item); }
public static ArgumentPropertyValue <string> NotNullOrEmpty(this ArgumentPropertyValue <string> item) { if (string.IsNullOrEmpty(item.Value)) { throw new ArgumentNullException(item.Name); } return(item); }
public static ArgumentPropertyValue <string> ShorterThan(this ArgumentPropertyValue <string> item, int limit) { if (item.Value.Length >= limit) { throw new ArgumentException(string.Format("Parameter {0} must be shorter than {1} chars", item.Name, limit)); } return(item); }
public static ArgumentPropertyValue <T> NotNull <T>(this ArgumentPropertyValue <T> item) where T : class { if (item.Value == null) { throw new ArgumentNullException(item.Name); } return(item); }