Class DataColumnCollectionExtensions
DataColumnCollection 扩展方法
Inherited Members
Namespace: Lett.Extensions
Assembly: Lett.Extensions.dll
Syntax
public static class DataColumnCollectionExtensions
Methods
| Improve this Doc View SourceAddRange(DataColumnCollection, IEnumerable<String>)
批量增加 DataColumn
Declaration
public static void AddRange(this DataColumnCollection this, IEnumerable<string> columnNames)
Parameters
Type | Name | Description |
---|---|---|
DataColumnCollection | this | |
IEnumerable<String> | columnNames | 列名集合 |
Examples
var dt = new DataTable();
var colNames = new List<string> {"Field1", "Field2", "Field3"};
dt.Columns.AddRange(colNames);
// dt.Columns == {"Field1", "Field2", "Field3"}
Exceptions
Type | Condition |
---|---|
DuplicateNameException |
|
AddRangeParams(DataColumnCollection, String[])
批量增加 DataColumn
Declaration
public static void AddRangeParams(this DataColumnCollection this, params string[] columnNames)
Parameters
Type | Name | Description |
---|---|---|
DataColumnCollection | this | |
String[] | columnNames | 列名集合 |
Examples
var dt = new DataTable();
dt.Columns.AddRange("Field1", "Field2", "Field3");
// dt.Columns == {"Field1", "Field2", "Field3"}
Exceptions
Type | Condition |
---|---|
DuplicateNameException |
|