Export (0) Print
Expand All

PropertyDescriptorCollection Class

Represents a collection of PropertyDescriptor objects.

System.Object
  System.ComponentModel.PropertyDescriptorCollection

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

[HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true)]
public class PropertyDescriptorCollection : IList, 
	IDictionary, ICollection, IEnumerable

The PropertyDescriptorCollection type exposes the following members.

  NameDescription
Public methodSupported by the XNA FrameworkPropertyDescriptorCollection(PropertyDescriptor[])Initializes a new instance of the PropertyDescriptorCollection class.
Public methodPropertyDescriptorCollection(PropertyDescriptor[], Boolean)Initializes a new instance of the PropertyDescriptorCollection class, which is optionally read-only.
Top

  NameDescription
Public propertySupported by the XNA FrameworkCountGets the number of property descriptors in the collection.
Public propertySupported by the XNA FrameworkItem[Int32]Gets or sets the PropertyDescriptor at the specified index number.
Public propertySupported by the XNA FrameworkItem[String]Gets or sets the PropertyDescriptor with the specified name.
Top

  NameDescription
Public methodSupported by the XNA FrameworkAddAdds the specified PropertyDescriptor to the collection.
Public methodSupported by the XNA FrameworkClearRemoves all PropertyDescriptor objects from the collection.
Public methodSupported by the XNA FrameworkContainsReturns whether the collection contains the given PropertyDescriptor.
Public methodSupported by the XNA FrameworkCopyToCopies the entire collection to an array, starting at the specified index number.
Public methodSupported by the XNA FrameworkEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by the XNA FrameworkFindReturns the PropertyDescriptor with the specified name, using a Boolean to indicate whether to ignore case.
Public methodSupported by the XNA FrameworkGetEnumeratorReturns an enumerator for this class.
Public methodSupported by the XNA FrameworkGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by the XNA FrameworkIndexOfReturns the index of the given PropertyDescriptor.
Public methodSupported by the XNA FrameworkInsertAdds the PropertyDescriptor to the collection at the specified index number.
Protected methodInternalSort(IComparer)Sorts the members of this collection, using the specified IComparer.
Protected methodInternalSort(String[])Sorts the members of this collection. The specified order is applied first, followed by the default sort for this collection, which is usually alphabetical.
Protected methodSupported by the XNA FrameworkMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by the XNA FrameworkRemoveRemoves the specified PropertyDescriptor from the collection.
Public methodSupported by the XNA FrameworkRemoveAtRemoves the PropertyDescriptor at the specified index from the collection.
Public methodSort()Sorts the members of this collection, using the default sort for this collection, which is usually alphabetical.
Public methodSort(IComparer)Sorts the members of this collection, using the specified IComparer.
Public methodSort(String[])Sorts the members of this collection. The specified order is applied first, followed by the default sort for this collection, which is usually alphabetical.
Public methodSort(String[], IComparer)Sorts the members of this collection. The specified order is applied first, followed by the sort using the specified IComparer.
Public methodSupported by the XNA FrameworkToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public Extension MethodAsParallel()Overloaded. Enables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension MethodAsParallel()Overloaded. (Defined by ParallelEnumerable.)
Public Extension MethodAsQueryable()Overloaded. Converts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodAsQueryable()Overloaded. (Defined by Queryable.)
Public Extension MethodSupported by the XNA FrameworkCast<TResult>()Overloaded. Casts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodSupported by the XNA FrameworkCast<TResult>()Overloaded. (Defined by Enumerable.)
Public Extension MethodSupported by the XNA FrameworkOfType<TResult>()Overloaded. Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Public Extension MethodSupported by the XNA FrameworkOfType<TResult>()Overloaded. (Defined by Enumerable.)
Top

  NameDescription
Public fieldStatic memberSupported by the XNA FrameworkEmptySpecifies an empty collection that you can use instead of creating a new one with no items. This static field is read-only.
Top

  NameDescription
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkICollection.CountGets the number of elements contained in the collection.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkICollection.IsSynchronizedGets a value indicating whether access to the collection is synchronized (thread safe).
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkICollection.SyncRootGets an object that can be used to synchronize access to the collection.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIDictionary.AddAdds an element with the provided key and value to the IDictionary.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIDictionary.ClearRemoves all elements from the IDictionary.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIDictionary.ContainsDetermines whether the IDictionary contains an element with the specified key.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIDictionary.GetEnumeratorReturns an enumerator for this class.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIDictionary.IsFixedSizeGets a value indicating whether the IDictionary has a fixed size.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIDictionary.IsReadOnlyGets a value indicating whether the IDictionary is read-only.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIDictionary.ItemGets or sets the element with the specified key.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIDictionary.KeysGets an ICollection containing the keys of the IDictionary.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIDictionary.RemoveRemoves the element with the specified key from the IDictionary.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIDictionary.ValuesGets an ICollection containing the values in the IDictionary.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIEnumerable.GetEnumeratorReturns an IEnumerator for the IDictionary.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList.AddAdds an item to the IList.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList.ClearRemoves all items from the collection.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList.ContainsDetermines whether the collection contains a specific value.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList.IndexOfDetermines the index of a specified item in the collection.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList.InsertInserts an item into the collection at a specified index.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIList.IsFixedSizeGets a value indicating whether the collection has a fixed size.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIList.IsReadOnlyGets a value indicating whether the collection is read-only.
Explicit interface implemetationPrivate propertySupported by the XNA FrameworkIList.ItemGets or sets an item from the collection at a specified index.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList.RemoveRemoves the first occurrence of a specified value from the collection.
Explicit interface implemetationPrivate methodSupported by the XNA FrameworkIList.RemoveAtRemoves the item at the specified index.
Top

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 PropertyDescriptorCollection 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 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 property with the specified name from the collection.

NoteNote

The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: Synchronization. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

The following code example creates a new PropertyDescriptorCollection using the properties on button1. It requires that button1 has been instantiated on a form.

PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);

The next example prints all the properties on a button in a text box. It requires that button1 and textBox1 have been instantiated on a form.

private void MyPropertyCollection() {
    // Creates a new collection and assign it the properties for button1.
    PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);

    // Displays each property in the collection in a text box. 
    foreach (PropertyDescriptor myProperty in properties)
       textBox1.Text += myProperty.Name + '\n';
 }

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft