Represents a collection of properties.
Object
PropertyDescriptorCollection
[Visual Basic] Public Class PropertyDescriptorCollection Implements ICollection, IEnumerable, IList [C#] public class PropertyDescriptorCollection : ICollection, IEnumerable, IList [C++] public __gc class PropertyDescriptorCollection : public ICollection, IEnumerable, IList [JScript] public class PropertyDescriptorCollection implements ICollection, IEnumerable, IList
PropertyDescriptorCollection is read-only; it does not implement methods that add or remove properties. You must inherit from this class to implement these methods.
Using the properties available in the EventDescriptorCollection class, you can query the collection about its contents. Use the Count property to determine the number of elements in the collection. Use the Item property (PropertyDescriptorCollection indexer) to get a specific property by index number or by name.
In addition to properties, you can use the Find method to get a description of the event with the specified name from the collection.
Namespace: System.ComponentModel
Assembly: System.dll
The following example prints all the events on a button in a text box. It assumes that Button1 has been instantiated on a form.
[Visual Basic]
Private Sub MyPropertyCollection() ' Create a new collection and assign it the properties for Button1. Dim properties As PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(Button1) ' Use myProperty to print the name of each property. Dim myProperty As PropertyDescriptor For Each myProperty In properties TextBox1.Text &= " " & myProperty.Name Next End Sub
PropertyDescriptorCollection Members | System.ComponentModel Namespace | PropertyDescriptor | TypeDescriptor