Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# Errors for declaring array
Message
De
08/11/2009 10:37:40
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
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:
01433752
Vues:
46
>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];
>
>
>namespace Hour1
>{
>    public partial class viewerForm : Form
>    {
>        const bool c_defPromptOnExit = false;
>        string[] strMyArray;
>            strMyArray = new string[10];
>
Cecil,
You are doing it wrong and it is not something specifi to VS2010 (it was always like that):
namespace Hour1
{
    public partial class viewerForm : Form
    {
        const bool c_defPromptOnExit = false;
        string[] strMyArray = new string[10];
is the correct syntax (you are declaring member variables).
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform