Working with Collections - Day 2 - Part 6
- Posted: Nov 11, 2010 at 5:46 PM
- 23,866 Views
- 3 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
You will often need to work with groups of instances of classes and this video explains how to use one collection—the List<T>—to keep references to multiple instances of a given class. Bob demonstrates how to add instances of objects to a collection and how to iterate through each instance inside the collection using the “for each” statement, a variation on the “for iteration” statement we learned about on Day 1.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
So would you say a List is similar to an array? Looks pretty similar, and I like the foreach loop.
Cheers Bob
@Mintydog:
Arrays do exist in C#, but I like Lists much better. With lists, you don't have to define a maximum size, and are generally much easier to work with.
@Mintydog: Lists allow you to do a bit more complex operations like inserting, removing, ...
Remove this comment
Remove this thread
close