コード例 #1
0
        private static bool IsNotFuncType(ParameterInfo parameter, IMethodInfo method)
        {
            if (parameter == null)
            {
                return(true);
            }

            if (parameter.ParameterType.BaseType == typeof(MulticastDelegate))
            {
                return(false);
            }

            var parameterType = parameter.ParameterType;

            if (parameterType.FullName == null)
            {
                if (!method.IsGenericMethod)
                {
                    return(true);
                }

                parameterType = method.GetGenericArgumentFor(parameter.ParameterType);
            }

            return
                (!(parameterType.FullName.StartsWith("System.Action", StringComparison.Ordinal) ||
                   parameterType.FullName.StartsWith("System.Func", StringComparison.Ordinal)) ||
                 // ReSharper disable once PossibleUnintendedReferenceComparison
                 (parameter.ParameterType.Assembly != typeof(Action).Assembly));
        }