I want to set a list of strings (lets say fruit in the example). And when the button is clicked i would like a random fruit from the list I set to be selected.
So far this is what i got, it only returns a single letter from the fruits in the list instead of the full fruit name.
private void button1_Click(object sender, EventArgs e)
{
List<string> fruitClass = new List<string>
{
"apple",
"orange",
"banana"
};
Random randomyumyum = new Random();
int randomIndex = randomyumyum.Next(0, 3);
string chosenfruit = fruitClass[randomIndex];
Random singlefruit = new Random();
int randomNumber = singlefruit.Next(fruitClass.Count);
string chosenString = fruitClass[randomNumber];
MessageBox.Show(chosenString[randomyumyum.Next(0, 3)].ToString());
}
}