Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# Errors for declaring array
Message
From
08/11/2009 10:44:59
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 3.0
OS:
Vista
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01433718
Message ID:
01433753
Views:
41
>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
>

You are interpreting it wrong. Nothing has changed in 2010. It was always like that.
public class test
{
 int[] numbers = new int[10]; // need to be in a single line
 static void Main()
 {
   int[] myNumbers;
   myNumbers = new int[10];
 }
}
is legal syntax in all versions. And the following is illegal yet again in all versions:
public class test
{
 int[] numbers;
 numbers = new int[10]; // need to be in a single line
 static void Main()
 {
   int[] myNumbers;
   myNumbers = new int[10];
 }
}
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform