Add columns to data tables. Columns can be added before or after rows have been added.
The command operates in two modes, single column or multiple columns mode.
Multiple mode In multiple mode it is possible to provide a string array of column names. This is a fast and simple way to quickly populate a table with empty columns.
Single mode In single mode each call adds a single column to the table. The difference is that when single mode is used it is possible to add caption, defaultvalue and expressions.
This example demostrates the use of multiple mode to create four columns in the DataTable object.
This example demostrates the use of single mode to create one column with a caption and a default value.
This example demostrates the use of single mode to create one column with an expression
Defined the DataTable that columns should be added to
Defines the names of the columns. This is used to reference the column in the datatable.
Sets the caption of the column. This is used when creating table views.
Sets the default value of a column. When set the cell of each row will get initialized with this default value.
Sets a expression to calculate the cell value.
For more information about expression variables and syntax see microsoft docs https://docs.microsoft.com/en-us/dotnet/api/system.data.datacolumn.expression?view=net-5.0
Defaults to true, if set to false column will not allow null values
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
This page was auto-generated from the powershell command comment based help. To edit the content of this page, update the script file comment based help on github Github