We can add elements to the end of an List using the .Add() method.
.Add() takes one parameter and "pushes" it onto the end of the list:
List<int> arr1 = new List<int>(new[] {1, 2, 3});
arr1.Add(4);
// arr1 is now [1, 2, 3, 4]
Assignment
Follow the Coding Tutorial and let's play with some arrays.
Hint
Look at the examples above if you get stuck.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
