I'm pretty expereinced in java and can't seem to figure out how to use a global variable in a sense.
How would I access the list foodSource in the on selectedIndexChanged method? I want to have it so when an item is selected, its price is displayed in a separate label.
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        initFood();
    }
    private void initFood()
    {
        var foodSource = new List<Food>();
        foodSource.Add(new Food { name = "Pizza", price = 10 });
        foodSource.Add(new Food { name = "Burger", price = 15 });
        foodSource.Add(new Food { name = "Chips", price = 5 });
        this.menu.DataSource = foodSource;
        menu.DisplayMember = "name";
    }
    private void menu_SelectedIndexChanged(object sender, EventArgs e)
    {
    }
    private void label1_Click(object sender, EventArgs e)
    {
    }
}
 
     
     
    