CollectionQueryableExtensions Class
Namespace: PTS.Collections
Assembly: PTS.Collections.dll
Syntax
public static class CollectionQueryableExtensions
Inheritance
System.Object
CollectionQueryableExtensions
Methods
OrderBy<TSource, TKey>(IQueryable<TSource>, Expression<Func<TSource, TKey>>, Boolean)
Orders the source
by descending
Declaration
public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, bool descending)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | The source. |
System.Linq.Expressions.Expression<System.Func<TSource, TKey>> | keySelector | The key selector. |
System.Boolean | descending | if set to |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TSource> |
Type Parameters
Name | Description |
---|---|
TSource | The type of the source. |
TKey | The type of the key. |
Paged<T>(IQueryable<T>, Int32, Int32)
Applies paging to the IQueryable source.
Declaration
public static IQueryable<T> Paged<T>(this IQueryable<T> source, int pageNumber, int pageSize)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<T> | source | The source. |
System.Int32 | pageNumber | The page number (sarting from 1). |
System.Int32 | pageSize | Size of the page. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<T> |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | pageNumber - The page number must be greater or equal 1. |
ToPagedList<T>(IQueryable<T>, Int32, Int32)
Gets a paged collection from the IQueryable source. Note: Any already applied pagination might cause unexpected behaviour.
Declaration
public static PagedList<T> ToPagedList<T>(this IQueryable<T> source, int pageNumber, int pageSize)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<T> | source | The source. |
System.Int32 | pageNumber | Page number (starting from 1). |
System.Int32 | pageSize | Page size. |
Returns
Type | Description |
---|---|
PagedList<T> |
Type Parameters
Name | Description |
---|---|
T | The type. |
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()