Exemple #1
0
 /// <summary>
 /// Sort the element of a queryable sequence by a given sort expression.
 /// </summary>
 /// <typeparam name="T">Type of items in sequence.</typeparam>
 /// <param name="source">Sequence to be sorted.</param>
 /// <param name="sortExpression">A SQL-like sort expression with comma separated property names (and optional direction specifiers) (e.g. "Age DESC, Name")</param>
 /// <returns>A queryable object that can enumerate the elements in the input sequence ordered according to the given sort expression.</returns>
 /// <exception cref="System.ArgumentNullException"><paramref name="source"/> is null or <paramref name="sortExpression"/> is null</exception>
 /// <exception cref="ParserException">If <paramref name="sortExpression"/> is an invalid sort expression.</exception>
 public static IOrderedQueryable OrderBy(this IQueryable source, String sortExpression)
 {
     return(ComparerBuilder.OrderBy(source.ElementType, source, sortExpression));
 }
 /// <summary>
 /// Sort the element of a queryable sequence by a given sort expression.
 /// </summary>
 /// <typeparam name="T">Type of items in sequence.</typeparam>
 /// <param name="source">Sequence to be sorted.</param>
 /// <param name="sortExpression">A SQL-like sort expression with comma separated property names (and optional direction specifiers) (e.g. "Age DESC, Name")</param>
 /// <returns>A queryable object that can enumerate the elements in the input sequence ordered according to the given sort expression.</returns>
 /// <exception cref="System.ArgumentNullException"><paramref name="source"/> is null or <paramref name="sortExpression"/> is null</exception>
 /// <exception cref="ParserException">If <paramref name="sortExpression"/> is an invalid sort expression.</exception>
 public static IOrderedQueryable <T> OrderBy <T>(this IQueryable <T> source, String sortExpression)
 {
     return(ComparerBuilder <T> .OrderBy(source, sortExpression));
 }