Table of Contents

Class DataTableExtensions

Namespace
FluentCommand.Extensions
Assembly
FluentCommand.dll

Provides extension methods for the DataTable class.

public static class DataTableExtensions
Inheritance
DataTableExtensions
Inherited Members

Methods

ToDataTable<T>(IEnumerable<T>, IEnumerable<string>)

Converts an IEnumerable<T> to a DataTable instance.

public static DataTable ToDataTable<T>(this IEnumerable<T> source, IEnumerable<string> ignoreNames = null) where T : class

Parameters

source IEnumerable<T>

The collection of objects to convert to a DataTable.

ignoreNames IEnumerable<string>

An optional collection of property names to ignore when creating columns in the DataTable. If null, all public properties are included.

Returns

DataTable

A DataTable populated with the data from the source collection, or null if source is null.

Type Parameters

T

The type of the elements in the source collection.

Remarks

This method uses ListDataReader<T> to read the data from the source collection and load it into a DataTable.