P
Peter
Hello,
Thanks for reviewing my question. I am new to C# and
would like to know why I am receiving an error with the
following code:
struct CARS
{
string sText;
int x;
};
CARS[] array = new CARS[] { {"Honda",0}, {"Toyota",0} };
Error:
Array initializers can only be used in a variable or
field initializer. Try using a new expression instead.
It seems that it doesn't like the enclosing curely braces.
Many Thanks
Peter
Thanks for reviewing my question. I am new to C# and
would like to know why I am receiving an error with the
following code:
struct CARS
{
string sText;
int x;
};
CARS[] array = new CARS[] { {"Honda",0}, {"Toyota",0} };
Error:
Array initializers can only be used in a variable or
field initializer. Try using a new expression instead.
It seems that it doesn't like the enclosing curely braces.
Many Thanks
Peter