System.ComponentModel.AttributeCollection.Contains C# (CSharp) Méthode

Contains() public méthode

public Contains ( Attribute attribute ) : bool
attribute System.Attribute
Résultat bool
        public bool Contains(Attribute attribute)
        {
            Attribute attr = this[attribute.GetType()];
            if (attr != null && attr.Equals(attribute))
            {
                return true;
            }
            return false;
        }

Usage Example

        // In the future, we may want to add Color, Date, etc.
        private bool CanEditProperty(PropertyDescriptor property)
        {
            // Don't show readonly properties
            if (property.IsReadOnly)
            {
                return(false);
            }

            // Don't show Shared personalizable properties in User mode
            if (WebPartManager != null &&
                WebPartManager.Personalization != null &&
                WebPartManager.Personalization.Scope == PersonalizationScope.User)
            {
                AttributeCollection attributes = property.Attributes;
                if (attributes.Contains(PersonalizableAttribute.SharedPersonalizable))
                {
                    return(false);
                }
            }

            // Only show properties that can be converted to/from string
            return(Util.CanConvertToFrom(property.Converter, typeof(string)));
        }
All Usage Examples Of System.ComponentModel.AttributeCollection::Contains