Class EnumerableExtensions
Class EnumerableExtensions.
Inheritance
Namespace: ISynergy.Framework.Core.Extensions
Assembly: ISynergy.Framework.Core.dll
Syntax
public static class EnumerableExtensions : object
Methods
View SourceCountPages<TSource>(IEnumerable<TSource>, Int32)
Counts the pages of an
Declaration
public static int CountPages<TSource>(this IEnumerable<TSource> source, int pageSize)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TSource> | source | The source. |
System.Int32 | pageSize | Has to be greater than 0. |
Returns
Type | Description |
---|---|
System.Int32 | System.Int32. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the t source. |
GetFlags(Enum)
Gets the flags.
Declaration
public static IEnumerable<Enum> GetFlags(this Enum value)
Parameters
Type | Name | Description |
---|---|---|
Enum | value | The value. |
Returns
Type | Description |
---|---|
IEnumerable<Enum> | IEnumerable<Enum>. |
GetIndividualFlags(Enum)
Gets the individual flags.
Declaration
public static IEnumerable<Enum> GetIndividualFlags(this Enum value)
Parameters
Type | Name | Description |
---|---|---|
Enum | value | The value. |
Returns
Type | Description |
---|---|
IEnumerable<Enum> | IEnumerable<Enum>. |
GetTypeOfT<T>(IEnumerable<T>)
Gets the type of t.
Declaration
public static Type GetTypeOfT<T>(this IEnumerable<T> _)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | _ | The . |
Returns
Type | Description |
---|---|
Type | Type. |
Type Parameters
Name | Description |
---|---|
T |
HasAny(Enum, Enum)
Determines whether the two specified values have any flags in common.
Declaration
public static bool HasAny(this Enum value, Enum desiredFlags)
Parameters
Type | Name | Description |
---|---|---|
Enum | value | Value to test |
Enum | desiredFlags | Flags we wish to find |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two specified values have any flags in common. |
ToDataTable(IEnumerable, Type, String)
Converts to datatable.
Declaration
public static DataTable ToDataTable(this IEnumerable collection, Type type, string tableName)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable | collection | The collection. |
Type | type | The type. |
System.String | tableName | Name of the table. |
Returns
Type | Description |
---|---|
DataTable | DataTable. |
ToDataTable<T>(IEnumerable<T>, String)
Converts to datatable.
Declaration
public static DataTable ToDataTable<T>(this IEnumerable<T> collection, string tableName)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | collection | The collection. |
System.String | tableName | Name of the table. |
Returns
Type | Description |
---|---|
DataTable | DataTable. |
Type Parameters
Name | Description |
---|---|
T |
ToPage<TSource>(IEnumerable<TSource>, Int32, Int32)
Applies paging to a
Declaration
public static IEnumerable<TSource> ToPage<TSource>(this IEnumerable<TSource> source, int page, int pageSize = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TSource> | source | The source. |
System.Int32 | page | Has to be non-negative. |
System.Int32 | pageSize | Has to be greater than 0. |
Returns
Type | Description |
---|---|
IEnumerable<TSource> | IEnumerable<TSource>. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the t source. |
Exceptions
Type | Condition |
---|---|
ArgumentBelowZeroException | pageSize |