i am writing a program that gathers data at certain moments in time (for example: after every 30 seconds). This data is organised into classes.
So what i want to have eventually is a List of Classes. This itself is not a big problem, since i can easily create a list. The one thing i don't get is when i add items to the list. Let's say i have the following List:
List<Market> listMarkets = new List<Market>();
That list works just fine.
Now let's say i want to add a Market to the list of markets every 30 seconds. How do i name this Market? So far i have created an array:
Market MarketArray = new Market;
Now at every time update, i create a new entry into the array and then add that to the list. This is (as far as i know) the only way to give the new entry a unique name. Is this correct or is there a simpler way?
I feel like it should be able to work without using the array and just adding the new item to the list directly (like you can do with strings), but i cant figure out how to make sure that my class has a unique name.
this might be a bit vague, but i hope anyone can help me. Any thoughts or ideas are appreciated.