C
C#2y ago
gabbyan

❔ Help with choosing between ArrayList and other types of collections

I was challenged to make a pokémon styled game without using classes and I wanted to know better ways to store pokémons and their respective moves. Maybe a 2D array? I'm not sure. Also, the variable and method names are in Italian.
9 Replies
ero
ero2y ago
easy: do not ever ever ever ever use ArrayList (which, by the way, is a class)
blinkbat
blinkbat2y ago
depending on what you want to do with the items, you might want an array, enumerable, or list.
gabbyan
gabbyanOP2y ago
why exactly? I didn't clarify well enough: I cannot CREATE classes myself
ero
ero2y ago
it is a 30 year old class and has been superceded by multiple classes List<T>, T[]
gabbyan
gabbyanOP2y ago
oh sorry I started coding in c# less than a week ago so I know basically nothing
Kouhai
Kouhai2y ago
The main reasons to avoid it is because ArrayList isn't generic.
blinkbat
blinkbat2y ago
very strange requirement for working in c# are you allowed to use structs or records
gabbyan
gabbyanOP2y ago
yep I know
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server