• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class SortBuilder

Fluent builder for multi-level sort operations on a Range. Created by the SortingExtensions.Sort extension method and Sort(Range).

Inheritance
object
SortBuilder
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class SortBuilder
Remarks

Each call to By(int, bool) adds a sort level. Call Apply() to execute the sort.

worksheet.GetRange("A1:C10")
    .Sort(ascending: true)
    .By(1, descending: true)
    .Apply();

Properties

SortState

Gets the underlying SortState that will be applied.

Declaration
public SortState SortState { get; }
Property Value
Type Description
SortState
Remarks

Each call to By(int, bool) adds a sort level. Call Apply() to execute the sort.

worksheet.GetRange("A1:C10")
    .Sort(ascending: true)
    .By(1, descending: true)
    .Apply();

Methods

Apply()

Executes the sort described by this builder.

Declaration
public void Apply()
Remarks

Each call to By(int, bool) adds a sort level. Call Apply() to execute the sort.

worksheet.GetRange("A1:C10")
    .Sort(ascending: true)
    .By(1, descending: true)
    .Apply();

By(int, bool)

Adds a sort level for the specified column index.

Declaration
public SortBuilder By(int columnIndex, bool descending = false)
Parameters
Type Name Description
int columnIndex

Zero-based index of the column within the sort range.

bool descending

When true sort this level descending; otherwise ascending.

Returns
Type Description
SortBuilder
Remarks

Each call to By(int, bool) adds a sort level. Call Apply() to execute the sort.

worksheet.GetRange("A1:C10")
    .Sort(ascending: true)
    .By(1, descending: true)
    .Apply();
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX