help
Root Question Message
List<T>
string[] plants = {};
createPlant(ref plants);
createPlant(ref plants);
createPlant(ref plants);
Console.WriteLine(plants[0] + plants[1]);
Console.ReadLine();
// avolva aventine
static void createPlant(ref string[] plants)
{
Console.WriteLine("What is the Name of your Plant?");
plants = new string[] { Console.ReadLine() };
Console.Write("Completed! Push any Button to Exit.");
Console.ReadLine();
//may just have to for now.
string print = "";
for (int i = 0; i < plants.Length; i++)
{
Console.Write(plants[i] + ", ");
}
Console.WriteLine(print);
Console.ReadLine();
}
string[]
, so obviously it won't take a List<string>
CreatePlant()
method you crate a brand new arrayint
and string
are different typesboolean
and UngaBunga
string[]
and List<string>
List<string>
is the square pegstring[]
type parameterList<T>
is not T[]
ref List<string> plants
as a parameter?Console.WriteLine(string "message")
?CreatePlant(plants)
var plants = new List<string>();
plants.Add("carrot");
plants.Add("hydrangea");
plants.Add("juniper");