❔ 2 Dimensional Lists?
This is a big question of mine. Is it possible? Will this solve my problem? Are classes better?
15 Replies
better for what? what problem?
Does this list wraps primitive types ?
Hey
idk what that means
so heres the issue
I have plants
the game lets you create plants
and stores the names in a list
but I need more
every plant stored must have -
- name
- calories
- population
so its
List<string>
right nowyes
and only stores names
its common to use class, you can have Plant class and
List<Plant> plants
and Plant class will have name, calories, population propertiesI have to be able to create new plants while running, would class let me do that
is this a list class?
yes List of Plant class
ok cool
so I can do
plants[0] and get the class?
yes you can access items by index like that
or use LINQ
sorry it took a bit, whats link?
also how do I get the number of items in a class
Well, you can use Count property of List<T> object.
e.x. apples.Count
thank you
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.