Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# Errors for declaring array
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 3.0
OS:
Vista
Database:
Visual FoxPro
Divers
Thread ID:
01433718
Message ID:
01433733
Vues:
47
Let's look first at declaring a string array: (Initializing it later)

We're talking strictly Visual Studio 2010 here:

When I do the declaration of the below array, the newly declared string array did not show up in Intellisense when I tried to initialize it.
string[] strMyStringArray;
This declaration works better:
string[] strMyStringArray = new string[5];
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform