System.ComponentModel.ReflectEventDescriptor.FillAttributes C# (CSharp) Method

FillAttributes() protected method

protected FillAttributes ( IList attributes ) : void
attributes IList
return void
        protected override void FillAttributes(IList attributes)
        {
            //
            // The order that we fill in attributes is critical.  The list of attributes will be
            // filtered so that matching attributes at the end of the list replace earlier matches
            // (last one in wins).  Therefore, the two categories of attributes we add must be
            // added as follows:
            //
            // 1.  Attributes of the event, from base class to most derived.  This way
            //     derived class attributes replace base class attributes.
            //
            // 2.  Attributes from our base MemberDescriptor.  While this seems opposite of what
            //     we want, MemberDescriptor only has attributes if someone passed in a new
            //     set in the constructor.  Therefore, these attributes always
            //     supercede existing values.
            //

            FillMethods();
            Debug.Assert(_componentClass != null, "Must have a component class for FilterAttributes");
            if (_realEvent != null)
            {
                FillEventInfoAttribute(_realEvent, attributes);
            }
            else
            {
                Debug.Assert(_removeMethod != null, "Null remove method for " + Name);
                FillSingleMethodAttribute(_removeMethod, attributes);

                Debug.Assert(_addMethod != null, "Null remove method for " + Name);
                FillSingleMethodAttribute(_addMethod, attributes);
            }

            // Include the base attributes.  These override all attributes on the actual
            // property, so we want to add them last.
            //
            base.FillAttributes(attributes);
        }