I have a class that look like this
public class Bottle
{
private string Brand = "";
private string Beverage = "";
private int Price =0;
public Bottle(string _Brand, string _Beverage, int _Price)
{
Brand = _Brand;
Beverage = _Beverage;
Price =_Price;
}
}
Then i made an array of them:
public Bottle[] Soda = new Bottle[25];
In a menu the user can chose to press 1, 2 or 3 to choose a soda to add. For example if they choose '1', they can then select a "place" in the array to store the soda. Like this:
Soda[userPlacement]= new Bottle("Cola","Soda",10);
My question is:
How do i Search that Array for Cola as example?
i've tried Array.find
, and Array.indexOf
but they didn't work.