Beispiel #1
0
        /// <summary>
        /// Check if the method calls another method which matches the given pattern.
        /// </summary>
        /// <param name="method">Method to check</param>
        /// <param name="codePattern">Pattern to check against</param>
        /// <returns>true if method calls another which matches, false if not</returns>
        public static Boolean MatchesIndirect(this MethodDef method, IList <Code> codePattern)
        {
            if (method == null)
            {
                throw new ArgumentNullException();
            }

            return(method.Calls().FirstOrDefault((called) =>
            {
                MethodDef def = called as MethodDef;
                if (def == null)
                {
                    return false;
                }
                else
                {
                    return def.Matches(codePattern);
                }
            }) != null);
        }