AddColumns Method
The AddColumns method adds multiple columns to the table by calling AddColumn for each metadata entry.
It is useful when you already have a list of prepared IColumnMetadata instances (for example, when cloning schema from another table).
/// <summary>
/// Adds columns
/// </summary>
/// <param name="listOfColumnMetadata">List of column metadata</param>
public void AddColumns(IReadOnlyList<IColumnMetadata> listOfColumnMetadata)
Namespace: PocoDataSet.Data
Assembly: PocoDataSet.Data.dll
listOfColumnMetadata and calls AddColumn(IColumnMetadata) for each entry.null when missing).
using System.Collections.Generic;
using PocoDataSet.Data;
using PocoDataSet.IData;
DataTable source = new DataTable();
source.TableName = "Employee";
source.AddColumn("Id", DataTypeNames.INT32, isNullable: false, isPrimaryKey: true);
source.AddColumn("Name", DataTypeNames.STRING, isNullable: true);
// Prepare metadata list (example: copy from source schema)
List<IColumnMetadata> cols = new List<IColumnMetadata>();
for (int i = 0; i < source.Columns.Count; i++)
{
cols.Add(source.Columns[i].Clone());
}
DataTable target = new DataTable();
target.TableName = "Employee";
target.AddColumns(cols);
AddColumn repeatedly is equivalent.Table of Content POCO DataSet API References POCO DataSet Types DataTable Members
Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the
Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate
credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness
or suitability of the information and are not responsible for any damages
resulting from its use.