System.Reflection.MethodInfo.GetParentDefinition C# (CSharp) Method

GetParentDefinition() private method

private GetParentDefinition ( ) : MethodInfo
return MethodInfo
        internal virtual MethodInfo GetParentDefinition() { return null; }
        #endregion

Usage Example

Esempio n. 1
0
        // For ParameterInfo's we need to make sure that we chain through all the MethodInfo's in the inheritance chain.
        // We pick up all the CustomAttributes for the starting ParameterInfo. We need to pick up only attributes that are marked inherited from the remainder of the ParameterInfo's in the inheritance chain.
        // For MethodInfo's on an interface we do not do an inheritance walk. For ParameterInfo's on a
        // Class we walk up the inheritance chain but do not look at the MethodInfo's on the interfaces that the
        // class inherits from.
        private static bool InternalParamIsDefined(MethodInfo method,ParameterInfo param,Type type, bool inherit)
        {
            if (param.IsDefined(type, false))
                return true;
            
            if (method.DeclaringType == null || !inherit) // This is an interface so we are done.
                return false;
        
            int paramPosition = param.Position;
            method = method.GetParentDefinition();
                        
            while (method != null)
            {
                ParameterInfo [] parameters = method.GetParameters();
                param = parameters[paramPosition]; 

                Object [] objAttr = param.GetCustomAttributes(type, false); 
                                
                for (int i=0;i<objAttr.Length;i++)
                {
                    Type objType = objAttr[i].GetType();
                    AttributeUsageAttribute attribUsage = InternalGetAttributeUsage(objType);

                    if ((objAttr[i] is Attribute) 
                            && (attribUsage.Inherited))
                            return true;
                }
                    
                method = method.GetParentDefinition();
                
            } 

            return false;
        }
All Usage Examples Of System.Reflection.MethodInfo::GetParentDefinition