Listfruits = new List (); fruits.Add("Apple"); fruits.Add("Banana"); Console.WriteLine(fruits[1]); // Output: "Banana"
ListThis code creates a new list of integers called `numbers`. A for loop is used to add the numbers 0-9 to the end of the list using the `Add` method. Finally, the `Count` property of the list is printed to the console to confirm that there are indeed 10 items in the list.numbers = new List (); for (int i = 0; i < 10; i++) { numbers.Add(i); } Console.WriteLine(numbers.Count); // Output: 10