"Jon Skeet [C# MVP]" <sk***@pobox.com¼¶¼g©ó¶l¥ó·s»D:11***************** *****@c77g2000hse.googlegroups.com...
On Jul 5, 3:42 pm, "Macneed" <macn...@yahoo.com.hkwrote:
>hi i am a newbie of C#
can i use [,][] as a ref parameter?
Yes.
>like this
That's not your actual code. Please post a short but complete example
which demonstrates the problem, as per
http://pobox.com/~skeet/csharp/complete.html.
(And when you mention that there's an error, it would be helpful to
say what it is.)
Jon
Thanks
static void Main(string[] args)
{
const int Method=100;
float[,][] SPay = new float[100, 100][];
for (int i = 0; i < 100; )
{
for (int j = 0; j < 100; )
{
SPay[i,j++] = new float[Method]; //[Method] is sth like
that
}
i++;
}
Calc(ref SPay);
}
public static void Calc(ref float[,][] pSPay)
{
for (int i = 0; i < 100; )
{
for (int j = 0; j < 100; )
{
for (int k = 0; k < 100; )
{
pSPay[i, j][k++] = 10;
}
j++;
}
i++;
}
}
sth like that
after run
the cmd screen go to the background
and two windows at the bottom of code screen
the left one show that
Locals
Name Value Type
+ pSPay {Dimensions:[100,100]} float[,][]
i 0 int
....
the right one is
Call Stack
xxx.exe!xxx.Program.Calc(ref float[,][]pSPay = {Dimensions:[100,100]}Line
1480
xxx.exe!xxx.Program.Main(string[] args = {Dimensions:[0]} Line 296 + 0xb
bytes
the windows message is type, not copy out,
so may be a little little different,
Thanks all