Well, that's sure to break a lot of developers code. Whatever happened to backward compatibility? Are these actual errors (won't compile at all) or simply warnings? (I don't have VS 2010 installed yet, so I can't see for myself).
But, I did go and read the link you provided, and that's not what I get out of reading it. It says you *can* do what you were doing:
It is possible to declare an array variable without initialization, but you must use the new operator when you assign an array to this variable. For example:
int[] array3;
array3 = new int[] { 1, 3, 5, 7, 9 }; // OK
//array3 = {1, 3, 5, 7, 9}; // Error
Is the documentation wrong or is there a bug? Anyone else get around to trying this in VS 2010 yet?
~~Bonnie
>Okay, I did some digging in the MSDN help for Visual Studio 2010 Beta 2. It seems that Microsoft has changed the creation and initializing of arrays from a 2-step Texas jig to a 1-step Tennessee crawl, as follows:
>
>
http://msdn.microsoft.com/en-us/library/0a7fscd0(VS.100).aspx>
>Here's an example of how you'd set up an array of 10 integer array elements, and the same for a string array of 10 elements. It's a 1-step process in Visual Studio 2010 for C#. I tried it and there were no longer any errors.
>
>
>int[] numbers = new int[10];
>string[] strMyStringArray = new string[10];
>
>
>Cecil
>
>>I'll try this later in VS 2010, but first - what are the errors? I found I learned most of my syntax stuff by just hovering over any code that was wavy lined and letting the IDE tell me what the problem was.
>
>>>Why would the below simple declaration/initialization give me three errors in VS 2010 (C#)? I tried this in Visual Studio 2008 and it worked perfectly? Could this be a bug in Visual Studio 2010 Beta 2?
>>>
>>> string[] strMyArray;
>>> strMyArray = new string[10];