TypeConverterCreateDataTableT Method |
Creates a DataTable from an IEnumerable{T}.
Each element of the given source results in a row representing the properties of {T} as columns.
Namespace:
TB.ComponentModel
Assembly:
UniversalTypeConverter (in UniversalTypeConverter.dll) Version: 2.0.0
Syntax public DataTable CreateDataTable<T>(
IEnumerable<T> source,
IncompatibleDataColumnTypeHandling incompatibleDataColumnTypeHandling = IncompatibleDataColumnTypeHandling.ToString,
CultureInfo culture = null
)
Parameters
- source
- Type: System.Collections.GenericIEnumerableT
The IEnumerable{T} to create a DataTable from. - incompatibleDataColumnTypeHandling (Optional)
- Type: TB.ComponentModelIncompatibleDataColumnTypeHandling
Defines how a type is handled if not valid for a DataColumn of a DataTable.
ToString is used by default.
- culture (Optional)
- Type: System.GlobalizationCultureInfo
The culture to use if conversion is needed. If not given or null, the DefaultCulture is used.
Type Parameters
- T
- The type of the elements of source.
Return Value
Type:
DataTableA DataTable representing each element of the given source as a row.
See Also