I want a list of objects like the following to be accessible from anywhere, a "singleton" class as I understand.
public class Car
{
public string Name;
public string Color;
public int Value;
}
List<Vehicle> carList = new List<Vehicle>();
Car jeep = new Car();
jeep.Name = "Jeep";
jeep.Color = "Red";
jeep.Value = 20000;
Vehicle.Add(jeep);
Such that I can access and modify it anywhere in a Windows Forms application, using something like a button click with the following:
MessageBox.Show(Vehicle[0].name)
I'm missing something. How do I make list Vehicle public?