Export (0) Print
Expand All

PropertyDescriptorCollection.Sort Method (String[], IComparer)

Sorts the members of this collection. The specified order is applied first, followed by the sort using the specified IComparer.

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

public virtual PropertyDescriptorCollection Sort (
	string[] names,
	IComparer comparer
public PropertyDescriptorCollection Sort (
	String[] names, 
	IComparer comparer
public function Sort (
	names : String[], 
	comparer : IComparer
) : PropertyDescriptorCollection
Not applicable.



An array of strings describing the order in which to sort the PropertyDescriptor objects in this collection.


A comparer to use to sort the PropertyDescriptor objects in this collection.

Return Value

A new PropertyDescriptorCollection that contains the sorted PropertyDescriptor objects.

The following code example defines the sort order for the Sort method. If the PropertyDescriptorCollection contains four PropertyDescriptor objects with the names A, B, C, and D, the properties of myNewColl would be sorted in the order D, B, A, and C.

myNewColl = this.Sort(new string[]{"D", "B"});

myNewColl = this.Sort(new String[]{"D", "B"});

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

© 2015 Microsoft