|
-
Feb 19th, 2020, 11:36 AM
#7
Re: Adding a Variable by Clicking Button
A List is a wrapper on an array. If you haven't worked with arrays, they are pretty conceptually simple: It's a collection with a fixed size, kind of like an egg carton. That's a bit of a nuisance, as such, because egg cartons come in just a few sizes. If you need 13 eggs, you need two cartons, just because you have one egg more than most cartons hold. Therefore, the List was added so you have, in effect, a carton that can grow or shrink to meet your needs. There are Add, Insert, Remove, RemoveAt, and many others so that you can adjust the carton to hold not just the number you want, but also to hold them in the order you want.
Look up List(of T) for examples. They'd be better than we would likely write, but keep in mind, it's just a carton. A dictionary would be a carton with labels for each item so that you can get the items by label as well as by order.
My usual boring signature: Nothing
 
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|