|
-
February 13th, 2003, 10:46 AM
#1
Multi-Dimension array initializers
It's me again.... I know I'm troublesome.
First I have this:
protected int[,] array = new int[15,10];
then I do this:
map = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,0,1,0,0,0,0,0,1,1,1,0,0,0,1,
8,0,0,0,0,0,0,0,1,1,1,0,0,0,1,
1,0,0,0,1,1,1,0,0,1,0,0,0,0,1,
1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,
1,1,0,0,1,1,1,0,0,0,0,0,1,0,1,
1,0,0,0,0,1,0,0,0,0,1,1,1,0,1,
1,0,1,1,0,0,0,1,0,0,0,0,0,0,5,
1,0,1,1,0,0,0,1,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
And the compiler says this:
CMap.cs(31,43): error CS1525: Invalid expression term ','
CMap.cs(31,44): error CS1002: ; expected
CMap.cs(31,45): error CS1002: ; expected
Multiple times. And to my surprise,
neither the books "Inside C# second edition" nor "C# language specification" actually talks about that.
MSDN is a maze to me.
Question: How to I initialize a multiple dimensional array like this?
end------------------------------
Programmers aren't born, but are made from hardwork, effort and time.
To be a good one, requires more effort and hardwork.
Therefore N quality programmer = (N*hardwork)+(N*effort)+(N*time)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|