示例#1
0
 public bool Match(MethodInfo method)
 {
     _log.Debug("Method [{0}.{1}({2})] match pattern {3}.", method.ReflectedType.FullName, method.Name, method.GetParamsTypeArray().Join(','), _pattern);
     if (AccessModifierMatch(method) && ReturnTypeMatch(method) && TypeMatch(method)
         && MethodNameMatch(method) && ParamListMatch(method))
     {
         _log.Debug("Match success.");
         return true;
     }
     else
     {
         _log.Debug("Match fail.");
         return false;
     }
 }
示例#2
0
        private bool ParamListMatch(MethodInfo method)
        {
            Type[] paramTypeArray = method.GetParamsTypeArray();
            if (_paramPattern.Length == 0)
                return paramTypeArray.Length == 0;

            string paramList = paramTypeArray.Join<Type>(
                t => t.Name.StripGenericAndRef(), ',');

            Regex regex = new Regex(_paramPattern);
            return regex.IsMatch(paramList);
        }