GetGetMethod() public method

public GetGetMethod ( bool nonPublic ) : MethodInfo
nonPublic bool
return MethodInfo
Exemplo 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);
        }
Exemplo n.º 2
0
        // BEGIN helper methods for Dev11 466969 quirk
        internal bool HasMatchingAccessibility(RuntimePropertyInfo target)
        {
            Contract.Assert(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8);
            bool match = true;

            if (!IsMatchingAccessibility(this.GetGetMethod(true), target.GetGetMethod(true)))
            {
                match = false;
            }
            else if (!IsMatchingAccessibility(this.GetSetMethod(true), target.GetSetMethod(true)))
            {
                match = false;
            }

            return(match);
        }
Exemplo n.º 3
0
        // BEGIN helper methods for Dev11 466969 quirk
        internal bool HasMatchingAccessibility(RuntimePropertyInfo target)
        {
            Contract.Assert(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8);
            bool match = true;
            
            if (!IsMatchingAccessibility(this.GetGetMethod(true), target.GetGetMethod(true)))
            {
                match = false;
            }
            else if (!IsMatchingAccessibility(this.GetSetMethod(true), target.GetSetMethod(true)))
            {
                match = false;
            }

            return match;
        }