IAFList.Sort Method
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Sorts the items in the entire collection using the default comparer.
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
void Sort()
Sub Sort Dim instance As IAFList instance.Sort()
void Sort()
abstract Sort : unit -> unit
Exceptions
| Exception | Condition |
|---|---|
| InvalidOperationException | If the size of the collection is too large to perform the operation. This occurs when the number of items in the collection is greater than a page size and the IsPaging property is . |
Remarks
This method uses the default comparer for type T to determine the order of the items in the collection. If the item has a name, then the default comparer will normally sort the collection based upon the item's name.
This method uses Array.Sort, which uses the QuickSort algorithm. This implementation performs an unstable sort; that is, if two items are equal, their order might not be preserved. In contrast, a stable sort preserves the order of the items that are equal.
On average, this method is an O(n log n) operation, where n is Count; in the worst case it is an O(n^2) operation.