예제 #1
0
        /// <summary>Returns true if this code contains the method with the given name.</summary>
        public bool ContainsMethod(string methodName)
        {
            if (string.IsNullOrEmpty(methodName))
            {
                return(false);
            }

                        #if !NoNitroRuntime
            if (BaseScript != null)
            {
                return(BaseScript.ContainsMethod(methodName));
            }
                        #endif

            try{
                // Grab the method off this type:

                                #if NETFX_CORE
                MethodInfo mInfo = GetType().GetTypeInfo().GetDeclaredMethod(methodName.ToLower());
                                #else
                MethodInfo mInfo = GetType().GetMethod(methodName.ToLower());
                                #endif

                // Method is contained if we found something:
                return(mInfo != null);
            }catch (AmbiguousMatchException) {
                return(true);
            }
        }