Reputation: 11861
I have these two line of code here
var unitsMap = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
var tensMap = new[] { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };
And I keep getting red squiggly error underline underneath both my []
saying syntax error value expected. and I also get a red squiggly error underline underneath all my values (one, two, three, etc) but not for zero...the error is ; expected.
What Am I doing wrong?
Upvotes: 0
Views: 8696
Reputation: 1
if "; is expected" maybe before these lines you have forgotten to end your previous line. Otherwise do a recompile. Sometimes, intellisense has to be rebooted (don't know why). Reboot VS if you will see this mistake again.
Upvotes: 0
Reputation: 82096
Your using an older version of C# which doesn't support the var keyword, this was introduced in v3.0 and the minimum supported version of VS is 2008.
The equivalent in your version would be:
string[] unitsMap = { "zero", "one", ... };
srring[] tensMap = { "zero", "ten", ... };
Upvotes: 1
Reputation: 1519
As David mentioned, you must be using a different framework which doesn't support anonymous declarations.
I just tried it using 4.5 framework and it doesn't complain.
Upvotes: 2