Class EnumerableExtensions
Provides extension methods for performing basic operations such as sum, average, min , max and sorting on enumerable collections.
Inheritance
Inherited Members
Namespace: Syncfusion.DataSource.Extensions
Assembly: Syncfusion.DataSource.WinForms.dll
Syntax
public static class EnumerableExtensions
Methods
Average(IEnumerable<Int16>)
Determines the average of values.
Declaration
public static double Average(this IEnumerable<short> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int16> | source | Represents the queryable source. |
Returns
Type | Description |
---|---|
System.Double | Returns the double value. |
Average(IEnumerable<Nullable<Int16>>)
Determines the average of values.
Declaration
public static double? Average(this IEnumerable<short?> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Nullable<System.Int16>> | source | Represents the queryable source. |
Returns
Type | Description |
---|---|
System.Nullable<System.Double> | Returns the double value. |
Average<TSource>(IEnumerable<TSource>, Func<TSource, Int16>)
Determines the average of values.
Declaration
public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSource, short> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | Represents the queryable source. |
System.Func<TSource, System.Int16> | selector | Represents the function expression. |
Returns
Type | Description |
---|---|
System.Double | Returns the double value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Average<TSource>(IEnumerable<TSource>, Func<TSource, Nullable<Int16>>)
Determines the average of values.
Declaration
public static double? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, short?> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | Represents the queryable source. |
System.Func<TSource, System.Nullable<System.Int16>> | selector | Represents the function expression. |
Returns
Type | Description |
---|---|
System.Nullable<System.Double> | Returns the double value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Average<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int16>>)
Determines the average of values.
Declaration
public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, short>> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | Represents the queryable source. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Int16>> | selector | Represents the function expression. |
Returns
Type | Description |
---|---|
System.Double | Returns the double value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Average<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int16>>>)
Determines the average of values.
Declaration
public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, short?>> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | Represents the queryable source. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Nullable<System.Int16>>> | selector | Represents the function expression. |
Returns
Type | Description |
---|---|
System.Nullable<System.Double> | Returns the double value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
GetElementType(IEnumerable)
Gets the element type.
Declaration
public static Type GetElementType(this IEnumerable source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | source | Represents the enumerable source. |
Returns
Type | Description |
---|---|
System.Type | Returns the source type. |
GetItemPropertyInfo(IEnumerable)
Gets the property info.
Declaration
public static PropertyInfo GetItemPropertyInfo(this IEnumerable list)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | list | Represents the enumerable list. |
Returns
Type | Description |
---|---|
System.Reflection.PropertyInfo | Returns the property info. |
Max(IEnumerable<Int16>)
Gets the maximum value.
Declaration
public static short Max(this IEnumerable<short> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int16> | source | Represents the queryable source. |
Returns
Type | Description |
---|---|
System.Int16 | Returns the maximum value. |
Max(IEnumerable<Nullable<Int16>>)
Gets the maximum value.
Declaration
public static short? Max(this IEnumerable<short?> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Nullable<System.Int16>> | source | Represents the queryable source. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | Returns the maximum value. |
Max<TSource>(IEnumerable<TSource>, Func<TSource, Int16>)
Gets the maximum value.
Declaration
public static short Max<TSource>(this IEnumerable<TSource> source, Func<TSource, short> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | Represents the queryable source. |
System.Func<TSource, System.Int16> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Int16 | Returns the maximum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Max<TSource>(IEnumerable<TSource>, Func<TSource, Nullable<Int16>>)
Gets the maximum value.
Declaration
public static short? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, short?> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | Represents the queryable source. |
System.Func<TSource, System.Nullable<System.Int16>> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | Returns the maximum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Max<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int16>>)
Gets the maximum value.
Declaration
public static short Max<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, short>> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | Represents the queryable source. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Int16>> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Int16 | Returns the maximum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Max<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int16>>>)
Gets the maximum value.
Declaration
public static short? Max<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, short?>> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | Represents the queryable source. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Nullable<System.Int16>>> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | Returns the maximum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Min(IEnumerable<Int16>)
Gets the minimum value.
Declaration
public static short Min(this IEnumerable<short> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int16> | source | Represents the queryable source. |
Returns
Type | Description |
---|---|
System.Int16 | Returns the minimum value. |
Min(IEnumerable<Nullable<Int16>>)
Gets the minimum value.
Declaration
public static short? Min(this IEnumerable<short?> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Nullable<System.Int16>> | source | Represents the queryable source. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | Returns the minimum value. |
Min<TSource>(IEnumerable<TSource>, Func<TSource, Int16>)
Gets the minimum value.
Declaration
public static short Min<TSource>(this IEnumerable<TSource> source, Func<TSource, short> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | Represents the queryable source. |
System.Func<TSource, System.Int16> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Int16 | Returns the minimum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Min<TSource>(IEnumerable<TSource>, Func<TSource, Nullable<Int16>>)
Gets the minimum value.
Declaration
public static short? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, short?> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | Represents the queryable source. |
System.Func<TSource, System.Nullable<System.Int16>> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | Returns the minimum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Min<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int16>>)
Gets the minimum value.
Declaration
public static short Min<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, short>> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | Represents the queryable source. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Int16>> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Int16 | Returns the minimum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Min<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int16>>>)
Gets the minimum value.
Declaration
public static short? Min<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, short?>> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | Represents the queryable source. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Nullable<System.Int16>>> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | Returns the minimum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
OrderBy<T>(IEnumerable<T>, String, Func<String, Object, Object>)
Gets the sorting order.
Declaration
public static IEnumerable<T> OrderBy<T>(this IEnumerable<T> entities, string propertyName, Func<string, object, object> getFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | entities | Represents the collection entity. |
System.String | propertyName | Represents the property name. |
System.Func<System.String, System.Object, System.Object> | getFunc | Represents the function. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Returns the enumerable collection. |
Type Parameters
Name | Description |
---|---|
T | Represents the generic type parameter. |
OrderBy<T>(IEnumerable<T>, String, Func<String, Object, Object>, IComparer<Object>)
Gets the sorting order.
Declaration
public static IEnumerable<T> OrderBy<T>(this IEnumerable<T> entities, string propertyName, Func<string, object, object> getFunc, IComparer<object> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | entities | Represents the collection entity. |
System.String | propertyName | Represents the property name. |
System.Func<System.String, System.Object, System.Object> | getFunc | Represents the function. |
System.Collections.Generic.IComparer<System.Object> | comparer | Represents the comparer. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Returns the enumerable collection. |
Type Parameters
Name | Description |
---|---|
T | Represents the generic type parameter. |
OrderByDescending<T>(IEnumerable<T>, String, Func<String, Object, Object>)
Gets the sorting order as descending.
Declaration
public static IEnumerable<T> OrderByDescending<T>(this IEnumerable<T> entities, string propertyName, Func<string, object, object> getFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | entities | Represents the collection entity. |
System.String | propertyName | Represents the property name. |
System.Func<System.String, System.Object, System.Object> | getFunc | Represents the function. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Returns the enumerable collection. |
Type Parameters
Name | Description |
---|---|
T | Represents the generic type parameter. |
OrderByDescending<T>(IEnumerable<T>, String, Func<String, Object, Object>, IComparer<Object>)
Sorts the items in descending order.
Declaration
public static IEnumerable<T> OrderByDescending<T>(this IEnumerable<T> entities, string propertyName, Func<string, object, object> getFunc, IComparer<object> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | entities | Represents the collection entity. |
System.String | propertyName | Represents the property name. |
System.Func<System.String, System.Object, System.Object> | getFunc | Represents the function. |
System.Collections.Generic.IComparer<System.Object> | comparer | Represents the comparer. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Returns the enumerable collection. |
Type Parameters
Name | Description |
---|---|
T | Represents the generic type parameter. |
Sum(IEnumerable<Int16>)
Determines the sum of values.
Declaration
public static short Sum(this IEnumerable<short> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int16> | source | Represents the queryable source. |
Returns
Type | Description |
---|---|
System.Int16 | Returns the sum value. |
Sum(IEnumerable<Nullable<Int16>>)
Determines the sum of values.
Declaration
public static short? Sum(this IEnumerable<short?> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Nullable<System.Int16>> | source | Represents the queryable source. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | Returns the sum value. |
Sum<TSource>(IEnumerable<TSource>, Func<TSource, Int16>)
Determines the sum of values.
Declaration
public static short Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, short> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | Represents the queryable source. |
System.Func<TSource, System.Int16> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Int16 | Returns the sum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Sum<TSource>(IEnumerable<TSource>, Func<TSource, Nullable<Int16>>)
Determines the sum of values.
Declaration
public static short? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, short?> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSource> | source | Represents the queryable source. |
System.Func<TSource, System.Nullable<System.Int16>> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | Returns the sum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Sum<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int16>>)
Determines the sum of values.
Declaration
public static short Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, short>> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | Represents the queryable source. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Int16>> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Int16 | Returns the sum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
Sum<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int16>>>)
Determines the sum of values.
Declaration
public static short? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, short?>> selector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | Represents the queryable source. |
System.Linq.Expressions.Expression<System.Func<TSource, System.Nullable<System.Int16>>> | selector | Represents the expression function. |
Returns
Type | Description |
---|---|
System.Nullable<System.Int16> | Returns the sum value. |
Type Parameters
Name | Description |
---|---|
TSource | Represents the generic type parameter. |
ThenBy<T>(IOrderedEnumerable<T>, String, Func<String, Object, Object>)
Gets the sorting order.
Declaration
public static IEnumerable<T> ThenBy<T>(this IOrderedEnumerable<T> entities, string propertyName, Func<string, object, object> getFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedEnumerable<T> | entities | Represents the collection entity. |
System.String | propertyName | Represents the property name. |
System.Func<System.String, System.Object, System.Object> | getFunc | Represents the function. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Returns the enumerable collection. |
Type Parameters
Name | Description |
---|---|
T | Represents the generic type parameter. |
ThenBy<T>(IOrderedEnumerable<T>, String, Func<String, Object, Object>, IComparer<Object>)
Gets the sorting order.
Declaration
public static IEnumerable<T> ThenBy<T>(this IOrderedEnumerable<T> entities, string propertyName, Func<string, object, object> getFunc, IComparer<object> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedEnumerable<T> | entities | Represents the collection entity. |
System.String | propertyName | Represents the property name. |
System.Func<System.String, System.Object, System.Object> | getFunc | Represents the function. |
System.Collections.Generic.IComparer<System.Object> | comparer | Represents the comparer. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Returns the enumerable collection. |
Type Parameters
Name | Description |
---|---|
T | Represents the generic type parameter. |
ThenByDescending<T>(IOrderedEnumerable<T>, String, Func<String, Object, Object>)
Gets the sorting order.
Declaration
public static IEnumerable<T> ThenByDescending<T>(this IOrderedEnumerable<T> entities, string propertyName, Func<string, object, object> getFunc)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedEnumerable<T> | entities | Represents the collection entity. |
System.String | propertyName | Represents the property name. |
System.Func<System.String, System.Object, System.Object> | getFunc | Represents the function. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Returns the enumerable collection. |
Type Parameters
Name | Description |
---|---|
T | Represents the generic type parameter. |
ThenByDescending<T>(IOrderedEnumerable<T>, String, Func<String, Object, Object>, IComparer<Object>)
Gets the sorting order.
Declaration
public static IEnumerable<T> ThenByDescending<T>(this IOrderedEnumerable<T> entities, string propertyName, Func<string, object, object> getFunc, IComparer<object> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedEnumerable<T> | entities | Represents the collection entity. |
System.String | propertyName | Represents the property name. |
System.Func<System.String, System.Object, System.Object> | getFunc | Represents the function. |
System.Collections.Generic.IComparer<System.Object> | comparer | Represents the comparer. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Returns the enumerable collection. |
Type Parameters
Name | Description |
---|---|
T | Represents the generic type parameter. |