PISystems.Sort Method (IComparer(PISystem))
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public void Sort( IComparer<PISystem> comparer )
Public Sub Sort ( comparer As IComparer(Of PISystem) ) Dim instance As PISystems Dim comparer As IComparer(Of PISystem) instance.Sort(comparer)
public: void Sort( IComparer<PISystem^>^ comparer )
member Sort : comparer : IComparer<PISystem> -> unit
Parameters
- comparer
- Type: System.Collections.GenericIComparerPISystem
The IComparerT implementation to use when comparing items in the collection, or a to use the default comparer for type T.
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
If a comparer is provided, the items of the collection are sorted using the specified IComparerT implementation. If a is specified for the comparer, the default comparer is used to sort 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.