System.ComponentModel.AttributeCollection.Matches C# (CSharp) Method

Matches() public method

public Matches ( Attribute attribute ) : bool
attribute System.Attribute
return bool
        public bool Matches(Attribute attribute)
        {
            for (int i = 0; i < _attributes.Length; i++)
            {
                if (_attributes[i].Match(attribute))
                {
                    return true;
                }
            }
            return false;
        }

Usage Example

Example #1
0
        public virtual void AddAttribute( Attribute a )
        {
            AttributeCollection ac = new AttributeCollection( Attributes );
            if( ! ac.Matches( a ) )
            {
                ArrayList al = new ArrayList();
                if( Attributes != null )
                    al.AddRange( Attributes );
                al.Add( a );

                Attributes = (Attribute[]) al.ToArray( typeof(Attribute) );
            }
        }