Learn how to create a list in C#, then add elements, remove elements, count elements, and clear all elements. Explore the standard mistake of forgetting to instantiate the empty list in the constructor.
- [Instructor] In a earlier video, we used an array to hold…a list of potential names for our character.…In my case, this is on line 17.…Just a quick refresher, we created random names as an…array of strings.…You can tell it's an array because of…these square brackets here.…You can tell it's an array of strings based on the…type that's listed in front of the square braces.…The thing about an array is that they have fixed size.…
In this case, I've fixed the size to five,…so it's not possible to add more things to this array,…without reconstructing it.…C Sharp comes with a set of collection classes,…that allow you much more robust abilities,…with respective restoring lists of items.…What I want to do in our program is,…I want to add a simple invitatory system.…Your character will undoubtedly be carrying some equipment,…armor, magic wands, spell books, swords, shields,…whatever it is that the carry around.…
We're going to use a list to track that.…The first step in creating our list is going to be make a…class that can contain the items, that we are talking about.…
AuthorBruce Van Horn
- Exploring C# on a Mac
- Creating a reusable code library
- Classes and properties
- Loops, arrays, and lists
- Creating a console app
- Creating a command-line app
- Creating a Mac desktop app
- Creating a UI with view controllers and actions
Skill Level Beginner
1. C# on the Mac?
2. Getting Started with C#
3. Deeper into C#
4. Creating a Mac App
Next steps3m 14s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.