Method ToDataTable
View SourceToDataTable<T, TTable>(IEnumerable<T>, TTable)
Appends elements in the sequence as rows of a given DataTable object.
Declaration
public static TTable ToDataTable<T, TTable>(this IEnumerable<T> source, TTable table) where TTable : DataTable
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source. |
TTable | table | A |
Returns
Type | Description |
---|---|
TTable | The value passed in as |
Type Parameters
Name | Description |
---|---|
T | The type of the elements of |
TTable | The type of the DataTable in which to store data. |
Remarks
This operator uses immediate execution.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ToDataTable<T>(IEnumerable<T>, params Expression<Func<T, object>>[])
Appends elements in the sequence as rows of a given DataTable object with a set of lambda expressions specifying which members (property or field) of each element in the sequence will supply the column values.
Declaration
public static DataTable ToDataTable<T>(this IEnumerable<T> source, params Expression<Func<T, object>>[] expressions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source. |
Expression<Func<T, object>>[] | expressions | Expressions providing access to element members. |
Returns
Type | Description |
---|---|
DataTable | A DataTable representing the source. |
Type Parameters
Name | Description |
---|---|
T | The type of the elements of |
Remarks
This operator uses immediate execution.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ToDataTable<T>(IEnumerable<T>)
Converts a sequence to a DataTable object.
Declaration
public static DataTable ToDataTable<T>(this IEnumerable<T> source)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source. |
Returns
Type | Description |
---|---|
DataTable | A DataTable representing the source. |
Type Parameters
Name | Description |
---|---|
T | The type of the elements of |
Remarks
This operator uses immediate execution.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ToDataTable<T, TTable>(IEnumerable<T>, TTable, params Expression<Func<T, object>>[])
Appends elements in the sequence as rows of a given DataTable object with a set of lambda expressions specifying which members (property or field) of each element in the sequence will supply the column values.
Declaration
public static TTable ToDataTable<T, TTable>(this IEnumerable<T> source, TTable table, params Expression<Func<T, object>>[] expressions) where TTable : DataTable
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | source | The source. |
TTable | table | A |
Expression<Func<T, object>>[] | expressions | Expressions providing access to element members. |
Returns
Type | Description |
---|---|
TTable | The value passed in as |
Type Parameters
Name | Description |
---|---|
T | The type of the elements of |
TTable | The type of the DataTable in which to store data. |
Remarks
This operator uses immediate execution.
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|