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 Syntax
C# | Visual Basic | Visual C++ |
public static TTable ToDataTable<T, TTable>( this IEnumerable<T> source, TTable table, params Expression<Func<T, Object>>[] expressions ) where TTable : DataTable
<ExtensionAttribute> _ Public Shared Function ToDataTable(Of T, TTable As DataTable) ( _ source As IEnumerable(Of T), _ table As TTable, _ ParamArray expressions As Expression(Of Func(Of T, Object))() _ ) As TTable
public: [ExtensionAttribute] generic<typename T, typename TTable> where TTable : DataTable static TTable ToDataTable( IEnumerable<T>^ source, TTable table, ... array<Expression<Func<T, Object^>^>^>^ expressions )
Generic Template Parameters
- T
- The type of the elements of source.
- TTable
- The type of the input and resulting DataTable object.
Parameters
- source (IEnumerable<(Of <(<'T>)>)>)
- The source.
- table (TTable)
- The DataTable type of object where to add rows
- expressions (array<Expression<(Of <(<'Func<(Of <(<'T, Object>)>)>>)>)>>[]()[][])
- Expressions providing access to element members.
Return Value
A DataTable or subclass representing the source.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<(Of <(<'T>)>)>. When you use instance method syntax to call this method, omit the first parameter.
Remarks
This operator uses immediate execution.
Assembly: MoreLinq (Module: MoreLinq.dll) Version: 1.0.16006.0 (1.0.16006.1845)