UPDATE:
Nevermind. All I need to do is enclose them each in Parentheses. There went WAY too much time for something so simple. (Shame I don’t know how to delete this thread)
Original:
So, I have written a class with a 2 dimensional array member. It also has a member Method that combines two of these Grid classes. Here’s the weird bit – Powershell errors out when trying to reference the multidimensional array in the [Grid] class that is passed into the function.
class Grid { [system.management.automation.host.bufferCell[,]] $Cells ... [void] CombineGrid([Grid] $G) { ... } ... }
Here’s the bit where the problem occurs:
[void] CombineGrid ([Grid] $G){ ... $This.Cells[$y,$x] = $This.NewGridCell($G.cells[$y,$x].character, ... # ^ ^ # No error at this point, Referencing | # $This.cells Here it complains about a missing # ']', as though it's a regular array. ... }
Can anyone explain this to me? or how to get around the problem? I’m not sure how this could be. It’s not being compressed into Uni-dimensional array, since if I try to index into it as a normal array, I get the error “You cannot index into a 2 dimensional array with index [0].”
What am I missing?