Complete the code to add an item to the list.
List<string> fruits = new List<string>(); fruits.[1]("Apple");
The Add method adds an item to the end of the list.
Complete the code to remove an item from the list.
List<int> numbers = new List<int> {1, 2, 3};
numbers.[1](2);The Remove method deletes the first occurrence of the specified item from the list.
Fix the error in the code to find an item in the list.
List<string> names = new List<string> {"Anna", "Bob", "Cara"};
string found = names.[1](name => name == "Bob");The Find method searches for an item that matches the condition given by a lambda expression.
Fill both blanks to sort the list in ascending order and then remove the first item.
List<int> values = new List<int> {5, 3, 8};
values.[1]();
values.[2](values[0]);First, Sort() arranges the list in ascending order. Then, Remove() deletes the first item.
Fill all three blanks to add a new item, find it, and then remove it from the list.
List<string> pets = new List<string> {"Cat", "Dog"};
pets.[1]("Bird");
string foundPet = pets.[2](p => p == "Bird");
pets.[3](foundPet);We add "Bird" with Add, find it with Find, then remove it with Remove.
