Created
May 3, 2010 04:51
-
-
Save spoon16/387768 to your computer and use it in GitHub Desktop.
Why is the output of this function (line:46 - $row) an instance of System.Array instead of an instance of Intellidimension.Rdf.TableRow?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-TableRow { | |
<# | |
.Synopsis | |
Creates a new table row that can be added to a table | |
.Description | |
Creates a new Intellidimension.Rdf.TableRow instance that can be added to a table | |
.Parameter cellCount | |
The number of cells the row will have | |
.Parameter table | |
The source table the new row should use as a template | |
.Parameter cells | |
The values that the new row should be initialized with | |
#> | |
[CmdletBinding(DefaultParameterSetName = "FromInt_ParamSet")] | |
param ( | |
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = "FromInt_ParamSet")] | |
[Alias("count")] | |
[int] $cellCount, | |
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = "FromTable_ParamSet")] | |
[Alias("tbl", "t")] | |
[Intellidimension.Rdf.Table] $table, | |
[Parameter(Mandatory = $true, Position = 1)] | |
[Intellidimension.Rdf.RdfValue[]] $cells | |
) | |
# begin { | |
# } | |
process { | |
switch ($PsCmdlet.ParameterSetName) { | |
"FromTable_ParamSet" { | |
$row = $table.NewRow($cells) | |
} | |
"FromInt_ParamSet" { | |
$row = New-Object Intellidimension.Rdf.TableRow $cellCount | |
for ($i = 0; $i -lt $row.Count -and $i -lt $cells.Length; $i ++) { | |
$v = $cells[$i] | |
$row.Cells[$i] = $cells[$i] | |
} | |
} | |
} | |
, $row | |
} | |
# end { | |
# } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment