beginner question in C#
-
Hi I am just starting programing in C# and I couldn't figure out how to do this. I have a function which returns a single dimensional array. Now I have to call this function 10 times and put this into a double dimensional array. i did this: /***********************************************************/ int[,] output = new int[10,100]; for(int i=0; i<10; i++) output[i] = func(); --- func returns int[100] /***********************************************************/ But it is giving error that output[i] should have two arguments. Any help would be greatly appreciated bart
-
Hi I am just starting programing in C# and I couldn't figure out how to do this. I have a function which returns a single dimensional array. Now I have to call this function 10 times and put this into a double dimensional array. i did this: /***********************************************************/ int[,] output = new int[10,100]; for(int i=0; i<10; i++) output[i] = func(); --- func returns int[100] /***********************************************************/ But it is giving error that output[i] should have two arguments. Any help would be greatly appreciated bart
You'll need to do something like this... int[,] output = new int[10, 100]; for (int i = 0; i < 10; i++) output[i,0] = func();
-
Hi I am just starting programing in C# and I couldn't figure out how to do this. I have a function which returns a single dimensional array. Now I have to call this function 10 times and put this into a double dimensional array. i did this: /***********************************************************/ int[,] output = new int[10,100]; for(int i=0; i<10; i++) output[i] = func(); --- func returns int[100] /***********************************************************/ But it is giving error that output[i] should have two arguments. Any help would be greatly appreciated bart
output is not a 2 dimensional array. its a 1-dimen. array which happens to be maintaining another 1-dim array. /***********************************************************/ int[,] output = new int[10]; for(int i=0; i<10; i++) output[i] = func(); --- func returns int[100] /***********************************************************/