There is a compilation error in my next code,
Error 1: It is not possible to implicitly convert the type 'TestArray1.Foo [, *]' to 'TestArray1.Foo [] [] []' C: \ Users \ lma \ Documents \ Visual Studio 2008 \ Projects \ TestArray1 \ TestArray1 \ Program.cs 17 30 TestArray1
Does anyone have any ideas? Here is my whole code, I am using VSTS 2008 + Vista 64-bit.
namespace TestArray1 { class Foo { } class Program { static void Main(string[] args) { Foo[][][] foos = new Foo[1, 1, 1]; return; } } }
EDIT: version 2. I have a different version of the code, but still have a compilation error. Any ideas?
Error 1 Invalid rank specifier: expected ',' or ']' C:\Users\lma\Documents\Visual Studio 2008\Projects\TestArray1\TestArray1\Program.cs 17 41 TestArray1 Error 2 Invalid rank specifier: expected ',' or ']' C:\Users\lma\Documents\Visual Studio 2008\Projects\TestArray1\TestArray1\Program.cs 17 44 TestArray1 namespace TestArray1 { class Foo { } class Program { static void Main(string[] args) { Foo[][][] foos = new Foo[1][1][1]; return; } } }
EDIT: version 3. I think I want to have a gear array. And after studying from guys. Here is my code fix, and it compiles fine in VSTS 2008. What I want is a jagged array, and currently I only need to have one element. Can someone check if my code implements my goal correctly?
namespace TestArray1 { class Foo { } class Program { static void Main(string[] args) { Foo[][][] foos = new Foo[1][][]; foos[0] = new Foo[1][]; foos[0][0] = new Foo[1]; foos[0][0][0] = new Foo(); return; } } }
thanks in advance George
source share