Exemplo n.º 1
0
 public static bool NameEquals([NotNull] this DynamicException ex, [NotNull] string name, StringComparison comparisonType = StringComparison.Ordinal)
 {
     if (ex == null)
     {
         throw new ArgumentNullException(nameof(ex));
     }
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentNullException(nameof(name));
     }
     return(ex.GetType().Name.Equals(name, comparisonType));
 }
Exemplo n.º 2
0
        public static bool NameMatches([NotNull] this DynamicException ex, [NotNull, RegexPattern] string pattern)
        {
            if (ex == null)
            {
                throw new ArgumentNullException(nameof(ex));
            }
            if (pattern == null)
            {
                throw new ArgumentNullException(nameof(pattern));
            }

            return(Regex.IsMatch(ex.GetType().Name, pattern, RegexOptions.IgnoreCase));
        }