EventDescriptorCollection.Sort Method

Definition

Sorts the members of this EventDescriptorCollection.

Overloads

Sort(String[], IComparer)

Sorts the members of this EventDescriptorCollection, given a specified sort order and an IComparer.

Sort(String[])

Sorts the members of this EventDescriptorCollection, given a specified sort order.

Sort()

Sorts the members of this EventDescriptorCollection, using the default sort for this collection, which is usually alphabetical.

Sort(IComparer)

Sorts the members of this EventDescriptorCollection, using the specified IComparer.

Sort(String[], IComparer)

Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs

Sorts the members of this EventDescriptorCollection, given a specified sort order and an IComparer.

C#
public virtual System.ComponentModel.EventDescriptorCollection Sort(string[] names, System.Collections.IComparer comparer);

Parameters

names
String[]

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

comparer
IComparer

An IComparer to use to sort the EventDescriptor objects in this collection.

Returns

The new EventDescriptorCollection.

Examples

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

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

Remarks

The specified sort order is applied first, followed by the sort using the specified IComparer.

Note

The HostProtectionAttribute attribute applied to this class 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.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Sort(String[])

Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs

Sorts the members of this EventDescriptorCollection, given a specified sort order.

C#
public virtual System.ComponentModel.EventDescriptorCollection Sort(string[] names);

Parameters

names
String[]

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

Returns

The new EventDescriptorCollection.

Examples

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

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

Remarks

The specified order is applied first, followed by the default sort for this collection, which is usually alphabetical.

Note

The HostProtectionAttribute attribute applied to this class 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.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Sort()

Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs

Sorts the members of this EventDescriptorCollection, using the default sort for this collection, which is usually alphabetical.

C#
public virtual System.ComponentModel.EventDescriptorCollection Sort();

Returns

The new EventDescriptorCollection.

Examples

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

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

Remarks

Note

The HostProtectionAttribute attribute applied to this class 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.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Sort(IComparer)

Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs
Source:
EventDescriptorCollection.cs

Sorts the members of this EventDescriptorCollection, using the specified IComparer.

C#
public virtual System.ComponentModel.EventDescriptorCollection Sort(System.Collections.IComparer comparer);

Parameters

comparer
IComparer

An IComparer to use to sort the EventDescriptor objects in this collection.

Returns

The new EventDescriptorCollection.

Examples

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

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

Remarks

The specified IComparer is applied first, followed by the default sort for this collection, which is usually alphabetical.

Note

The HostProtectionAttribute attribute applied to this class 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.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1