コード例 #1
0
        /// <summary>
        /// Retrieves the method with the specified name.
        /// </summary>
        /// <param name="methodName"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="methodName"/> is <see langword="null"/>.</para>
        /// -or-
        /// <para><paramref name="methodName"/> is an empty string.</para>
        /// </exception>
        /// <exception cref="NuGenMethodNotFoundException"/>
        public NuGenMethodInfo this[String methodName]
        {
            get
            {
                if (String.IsNullOrEmpty(methodName))
                {
                    throw new ArgumentNullException("methodName");
                }

                if (_instance != null)
                {
                    MethodInfo methodInfo = MemberFinder.FindMethod(_instance.GetType(), methodName);

                    if (methodInfo == null)
                    {
                        throw new NuGenMethodNotFoundException(methodName, _instance.GetType());
                    }

                    return(new NuGenMethodInfo(
                               methodInfo,
                               _instance
                               ));
                }

                return(new NuGenMethodInfo(
                           _staticType.GetMethod(methodName, NuGenBinding.Static)
                           ));
            }
        }
コード例 #2
0
        /// <summary>
        /// </summary>
        /// <param name="propertyName"></param>
        /// <returns></returns>
        public NuGenPropertyInfo FindProperty(String propertyName)
        {
            if (String.IsNullOrEmpty(propertyName))
            {
                return(null);
            }

            PropertyInfo propertyInfo = MemberFinder.FindProperty(_instance.GetType(), propertyName);

            if (propertyInfo != null)
            {
                return(new NuGenPropertyInfo(propertyInfo, _instance));
            }

            return(null);
        }
コード例 #3
0
        /// <summary>
        /// Retrieves the property with the specified name.
        /// </summary>
        /// <param name="propertyName"></param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="propertyName"/> is <see langword="null"/>.</para>
        /// -or-
        /// <para><paramref name="propertyName"/> is an empty string.</para>
        /// </exception>
        /// <exception cref="NuGenPropertyNotFoundException"/>
        public NuGenPropertyInfo this[String propertyName]
        {
            get
            {
                if (String.IsNullOrEmpty(propertyName))
                {
                    throw new ArgumentNullException("propertyName");
                }

                PropertyInfo propertyInfo = MemberFinder.FindProperty(_instance.GetType(), propertyName);

                if (propertyInfo == null)
                {
                    throw new NuGenPropertyNotFoundException(propertyName, _instance.GetType());
                }

                return(new NuGenPropertyInfo(propertyInfo, _instance));
            }
        }
コード例 #4
0
        /// <summary>
        /// Retrieves the field with the specified name.
        /// </summary>
        /// <param name="fieldName"></param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="fieldName"/> is <see langword="null"/>.</para>
        /// -or-
        /// <para><paramref name="fieldName"/> is an empty string.</para>
        /// </exception>
        /// <exception cref="NuGenFieldNotFoundException"/>
        public NuGenFieldInfo this[String fieldName]
        {
            get
            {
                if (String.IsNullOrEmpty(fieldName))
                {
                    throw new ArgumentNullException("fieldName");
                }

                FieldInfo fieldInfo = MemberFinder.FindField(_instance.GetType(), fieldName);

                if (fieldInfo == null)
                {
                    throw new NuGenFieldNotFoundException(fieldName, _instance.GetType());
                }

                return(new NuGenFieldInfo(
                           fieldInfo,
                           _instance
                           ));
            }
        }
コード例 #5
0
        /// <summary>
        /// Retrieves the event with the specified name.
        /// </summary>
        /// <param name="eventName"></param>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="eventName"/> is <see langword="null"/>.</para>
        /// -or-
        /// <para><paramref name="eventName"/> is an empty string.</para>
        /// </exception>
        /// <exception cref="NuGenEventNotFoundException"/>
        public NuGenEventInfo this[String eventName]
        {
            get
            {
                if (String.IsNullOrEmpty(eventName))
                {
                    throw new ArgumentNullException("eventName");
                }

                EventInfo eventInfo = MemberFinder.FindEvent(_instance.GetType(), eventName);

                if (eventInfo == null)
                {
                    throw new NuGenEventNotFoundException(eventName, _instance.GetType());
                }

                return(new NuGenEventInfo(
                           eventInfo,
                           _instance
                           ));
            }
        }