I need to handle a set of objects of the same type, as in the photo, the best option is List<>?

I need to handle a set of objects of the same type, as in the photo, the best option is List<>?

Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Oct 3, 2022, 4:13 AM EDT
it depends if the collection has to grow or not and how do you access it (randomly, sequentially...)
Vishal JoshiRank #377 · 6.7K reputationPosted Oct 3, 2022, 4:49 AM EDT
Hello
There are several options List, Array, ArrayList, Dictionary, etc. you can use either List or Dictionary. I would suggest if you are using lookup in your requirements go for Dictionary.
Because, When it comes to the lookup of data, a keyed collection is always faster than a non-keyed collection. This is because a non-keyed collection will have to enumerate its elements to find what you are looking for. While in a keyed collection you can just access the element directly via the key.
List<> is a non-keyed collection.
Dictionary is a keyed collection.
Vishvjit ShindeRank #3,119 · 459 reputationPosted Oct 4, 2022, 4:54 AM EDT
Yes, You can go with List