I have an Error when I'm running the code, instead of the array
i get System.string[]
can you help me?
this is the class (I removed some parts that wasn't necessarily such as the other constructors)
class food
{
public int amount;
public double weight;
public bool stock;
public string[] name = new string[3];
>this is the constructors
public void set(int amount, double weight, bool stock, string[] name)
{
this.amount = amount;
this.weight = weight;
this.stock = stock;
this.name = name;
public string[] doName()
{
return name;
}
}
this is the main
class MainClass
{
public static void Main(string[] args)
{
food food1 = new food();
string[] name = new string[3];
int amount = 0;
double weight = 0.0;
bool stock = false;
>I think the problem might be here but i'm not sure..
Console.Write("What Kind Of Food? ");
food1.name[0] = Console.ReadLine(); > i think the problem is somewhere here...
food1.set(amount, weight, stock, name);
Console.WriteLine(food1.doName());
}
}