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 DataTable ToDataTable<T>( this IEnumerable<T> source, params Expression<Func<T, Object>>[] expressions )
<ExtensionAttribute> _ Public Shared Function ToDataTable(Of T) ( _ source As IEnumerable(Of T), _ ParamArray expressions As Expression(Of Func(Of T, Object))() _ ) As DataTable
public: [ExtensionAttribute] generic<typename T> static DataTable^ ToDataTable( IEnumerable<T>^ source, ... array<Expression<Func<T, Object^>^>^>^ expressions )
Generic Template Parameters
- T
- The type of the elements of source.
Parameters
- source (IEnumerable<(Of <(<'T>)>)>)
- The source.
- expressions (array<Expression<(Of <(<'Func<(Of <(<'T, Object>)>)>>)>)>>[]()[][])
- Expressions providing access to element members.
Return Value
A DataTable 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)