System.ComponentModel.PropertyDescriptorCollection.Add C# (CSharp) Method

Add() public method

public Add ( PropertyDescriptor value ) : int
value PropertyDescriptor
return int
        public int Add(PropertyDescriptor value) {
            if (readOnly) {
                throw new NotSupportedException();
            }

            EnsureSize(propCount + 1);
            properties[propCount++] = value;
            return propCount - 1;
        }
        

Usage Example

 public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
 {
     PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection(null);
     descriptors.Add(new RuleConditionReferenceNamePropertyDescriptor(context, TypeDescriptor.CreateProperty(typeof(RuleConditionReference), "ConditionName", typeof(string), new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content), DesignOnlyAttribute.Yes })));
     descriptors.Add(new RuleConditionReferencePropertyDescriptor(context, TypeDescriptor.CreateProperty(typeof(RuleConditionReference), "Expression", typeof(CodeExpression), new Attribute[] { new DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content), DesignOnlyAttribute.Yes })));
     return descriptors.Sort(new string[] { "ConditionName", "Expression" });
 }
All Usage Examples Of System.ComponentModel.PropertyDescriptorCollection::Add