Click or drag to resize
Accord.NET (logo)

ExtensionMethodsAdd Method (DataColumnCollection, OrderedDictionaryString, Type)

Creates and adds multiple DataColumn objects with the given names at once.

Namespace:  Accord
Assembly:  Accord (in Accord.dll) Version: 3.8.0
Syntax
public static void Add(
	this DataColumnCollection collection,
	OrderedDictionary<string, Type> columns
)
Request Example View Source

Parameters

collection
Type: System.DataDataColumnCollection
The DataColumnCollection to add in.
columns
Type: Accord.CollectionsOrderedDictionaryString, Type
The names of the DataColumns to be created and added, alongside with their types.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataColumnCollection. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Examples
DataTable table = new DataTable();

// Add multiple columns at once:
table.Columns.Add(new OrderedDictionary>String, Type<()
{
    { "columnName1", typeof(int)    },
    { "columnName2", typeof(double) },
});
See Also