System.Reflection.RuntimePropertyInfo.GetGetMethod C# (CSharp) Method

GetGetMethod() public method

public GetGetMethod ( bool nonPublic ) : MethodInfo
nonPublic bool
return MethodInfo
        public override MethodInfo GetGetMethod(bool nonPublic) 
        {
            if (!Associates.IncludeAccessor(m_getterMethod, nonPublic))
                return null;

            return m_getterMethod;
        }

Usage Example

Esempio n. 1
0
        private static PropertyInfo?GetBasePropertyDefinition(RuntimePropertyInfo property)
        {
            MethodInfo?method = property.GetGetMethod(true);

            if (method == null || !method.IsVirtual)
            {
                method = property.GetSetMethod(true);
            }
            if (method == null || !method.IsVirtual)
            {
                return(null);
            }

            MethodInfo baseMethod = ((RuntimeMethodInfo)method).GetBaseMethod();

            if (baseMethod != null && baseMethod != method)
            {
                ParameterInfo[] parameters = property.GetIndexParameters();
                if (parameters != null && parameters.Length > 0)
                {
                    Type[] paramTypes = new Type[parameters.Length];
                    for (int i = 0; i < paramTypes.Length; i++)
                    {
                        paramTypes[i] = parameters[i].ParameterType;
                    }
                    return(baseMethod.DeclaringType !.GetProperty(property.Name, property.PropertyType,
                                                                  paramTypes));
                }
                else
                {
                    return(baseMethod.DeclaringType !.GetProperty(property.Name, property.PropertyType));
                }
            }
            return(null);
        }
All Usage Examples Of System.Reflection.RuntimePropertyInfo::GetGetMethod