Class SortOrderBuilder<T>
Utility class to construct a valid sort order parameter for a query to the Contentful API.
Inheritance
Inherited Members
Namespace:Contentful.Core.Search
Assembly:cs.temp.dll.dll
Syntax
public class SortOrderBuilder<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
SortOrderBuilder(String, SortOrder)
Initializes a new instance of SortOrderBuilder<T>
Declaration
protected SortOrderBuilder(string field, SortOrder order = SortOrder.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.String | field | The field to sort by. |
SortOrder | order | The order of the sorting. Default is Normal. |
Methods
Build()
Builds this sortorderbuilder and returns the produced querystring.
Declaration
public string Build()
Returns
Type | Description |
---|---|
System.String | The built querystring. |
New(String, SortOrder)
Creates a new instance of SortOrderBuilder<T>
Declaration
public static SortOrderBuilder<T> New(string field, SortOrder order = SortOrder.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.String | field | The field to sort by. |
SortOrder | order | The order of the sorting. Default is Normal. |
Returns
Type | Description |
---|---|
SortOrderBuilder<T> | A new SortOrderBuilder<T> instance. |
New<U>(Expression<Func<T, U>>, SortOrder)
Creates a new instance of SortOrderBuilder<T>
Declaration
public static SortOrderBuilder<T> New<U>(Expression<Func<T, U>> selector, SortOrder order = SortOrder.Normal)
Parameters
Type | Name | Description |
---|---|---|
Expression<System.Func<T, U>> | selector | The expression of the field to sort by. |
SortOrder | order | The order of the sorting. Default is Normal. |
Returns
Type | Description |
---|---|
SortOrderBuilder<T> | A new SortOrderBuilder<T> instance. |
Type Parameters
Name | Description |
---|---|
U |
ThenBy(String, SortOrder)
Adds another field to sort by to the current SortOrderBuilder<T>.
Declaration
public SortOrderBuilder<T> ThenBy(string field, SortOrder order = SortOrder.Normal)
Parameters
Type | Name | Description |
---|---|---|
System.String | field | The field to sort by. |
SortOrder | order | The order of the sorting. Default is Normal. |
Returns
Type | Description |
---|---|
SortOrderBuilder<T> | The SortOrderBuilder<T> instance. |
ThenBy<U>(Expression<Func<T, U>>, SortOrder)
Adds another field to sort by to the current SortOrderBuilder<T>.
Declaration
public SortOrderBuilder<T> ThenBy<U>(Expression<Func<T, U>> selector, SortOrder order = SortOrder.Normal)
Parameters
Type | Name | Description |
---|---|---|
Expression<System.Func<T, U>> | selector | The expression of the field to sort by. |
SortOrder | order | The order of the sorting. Default is Normal. |
Returns
Type | Description |
---|---|
SortOrderBuilder<T> | The SortOrderBuilder<T> instance. |
Type Parameters
Name | Description |
---|---|
U |