Part 7 - Collections

A collection is a structure that holds a number of the same types of values in a specific order. They provide functionality to easily access, search, sort and modify these values. Values can be added and removed as needed while your program is running. This section will cover how to use arrays and lists as collections of data.

Lists and Arrays

What do Do?

1 - Read through and complete the exercises in Part 7 - Arrays

2 - Read through and complete the exercises in Part 7 - Lists. You should be able to do the following by the end of this section:

      • Create a new list of any type:

          • An empty list.

          • Created with values at initialization time.

      • Add items to a list.

          • By appending the list (adds to the end).

          • By inserting to any position in the List (adds an element at a specified index).

      • Remove items from the list by index or by value (will remove the first occurrence with the specified value).

      • Modify values in the List by index.

      • Iterate through the List using a loop (counted for loop and for each loop).

      • Sort the list.

      • Here is the official C# documentation for a List:

3 - Complete the Lists PRogramming Assignment specified in Part 7 - List.

SUBMIT

1 - The Lists Programming Assignment specified in Part 7 - Lists.

Hints/FAQ

Q: What is the difference between a list and an array?

A: https://csharp-station.com/c-arrays-vs-lists/

Q: I want to use RemoveAll() instead of using a loop. How do I do it?

A: https://stackoverflow.com/questions/29895657/c-sharp-remove-an-int-from-a-listint