SortLevelCollection Class
Represents a collection of sort levels.
public sealed class SortLevelCollection : IEnumerable<SortLevel>, IEnumerable
Public NotInheritable Class SortLevelCollection
Implements IEnumerable(Of SortLevel), IEnumerable
- Inheritance:
- System.ObjectSortLevelCollection
Properties
Count
Gets the number of sort levels actually contained in the SortLevelCollection.
Property Value
- System.Int32
The number of sort levels actually contained in the SortLevelCollection.
Item[Int32]
Gets the SortLevel at the specified index.
public SortLevel this[int index] { get; }
Public ReadOnly Property Item(index As Integer) As SortLevel
Parameters
index
- System.Int32
The zero-based index of the SortLevel to get.
Property Value
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or is equal to or greater than Count.
Methods
Add(Int32)
Adds a new SortLevel applied to a column (or a row, if LeftToRight is true) with the specified index into the SortLevelCollection.
public SortLevel Add(int columnRowIndex)
Public Function Add(columnRowIndex As Integer) As SortLevel
Parameters
columnRowIndex
- System.Int32
Index of the column (or the row, if LeftToRight is true) relative to the Range that an added SortLevel applies to.
Returns
A new SortLevel applied to a column (or a row, if LeftToRight is true) with the specified index relative to the Range.
Exceptions
- System.ArgumentOutOfRangeException
columnRowIndex
is less than zero or is equal to or greater than Width (or Height, if LeftToRight is true) of the Range.
- System.ArgumentException
Column/row at the specified index is being sorted by the same criteria more than once. Delete the duplicate sort criteria and try again.
Clear()
Removes all SortLevels from the SortLevelCollection.
Get(Int32)
Gets the sort level applied to a column (or a row, if LeftToRight is true) with the specified index (relative to the Range) or null if such sort level doesn't exist.
public SortLevel Get(int columnRowIndex)
Public Function Get(columnRowIndex As Integer) As SortLevel
Parameters
columnRowIndex
- System.Int32
The index of a column (or a row, if LeftToRight is true) relative to the Range that a returned SortLevel applies to.
Returns
The sort level applied to a column (or a row, if LeftToRight is true) with the specified index (relative to the Range) or null if such sort level doesn't exist.
GetEnumerator()
Returns an enumerator that iterates through the sort levels.
public IEnumerator<SortLevel> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of SortLevel)
Returns
- System.Collections.Generic.IEnumerator<SortLevel>
An enumerator that can be used to iterate through the sort levels.
Insert(Int32, Int32)
Inserts a new SortLevel applied to a column (or a row, if LeftToRight is true) with the specified index into the SortLevelCollection at the specified index.
public SortLevel Insert(int index, int columnRowIndex)
Public Function Insert(index As Integer, columnRowIndex As Integer) As SortLevel
Parameters
index
- System.Int32
The zero-based index at which new SortLevel should be inserted.
columnRowIndex
- System.Int32
Index of the column (or the row, if LeftToRight is true) relative to the Range that an inserted SortLevel applies to.
Returns
A new SortLevel applied to a column (or a row, if LeftToRight is true) with the specified index relative to the Range.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or is equal to or greater than Count.
- System.ArgumentOutOfRangeException
columnRowIndex
is less than zero or is equal to or greater than Width (or Height, if LeftToRight is true) of the Range.
- System.ArgumentException
Column/row at the specified index is being sorted by the same criteria more than once. Delete the duplicate sort criteria and try again.
Move(Int32, Int32)
Moves the SortLevel at the specified index to a new location in the SortLevelCollection.
public void Move(int oldIndex, int newIndex)
Public Sub Move(oldIndex As Integer, newIndex As Integer)
Parameters
oldIndex
- System.Int32
The zero-based index specifying the location of the SortLevel to be moved.
newIndex
- System.Int32
The zero-based index specifying the new location of the SortLevel.
Exceptions
- System.ArgumentOutOfRangeException
oldIndex
is less than zero or is equal to or greater than Count.
- System.ArgumentOutOfRangeException
newIndex
is less than zero or is equal to or greater than Count.
Remove(SortLevel)
Removes the specific SortLevel from the SortLevelCollection.
public bool Remove(SortLevel sortLevel)
Public Function Remove(sortLevel As SortLevel) As Boolean
Parameters
sortLevel
- SortLevel
The SortLevel to remove from the SortLevelCollection.
Returns
- System.Boolean
true if SortLevel is successfully removed; otherwise, false. This method also returns false if SortLevel was null or was not found in the original SortLevelCollection.
Remove(Int32)
Removes a SortLevel applied to a column (or a row, if LeftToRight is true) with the specified index from the SortLevelCollection.
public bool Remove(int columnRowIndex)
Public Function Remove(columnRowIndex As Integer) As Boolean
Parameters
columnRowIndex
- System.Int32
Index of the column (or the row, if LeftToRight is true) relative to the Range that a removed SortLevel applies to.
Returns
- System.Boolean
true if SortLevel is successfully removed; otherwise, false. This method also returns false if SortLevel with the specified column/row index was not found in the original SortLevelCollection.
RemoveAt(Int32)
Removes the SortLevel at the specified index of the SortLevelCollection.
Parameters
index
- System.Int32
The zero-based index of the SortLevel to remove.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or is equal to or greater than Count.