Hello, I’m working on this task:
Create a new list of type string named countries with the following strings: “England”, “Sweden”, “Uzbekistan”, “London”.
Call the remove method on the list to remove the “London” cell.
Output the values of every cell in the list to the console, each on a new line.
Here is my code:
using System.Collections.Generic;
namespace Lists
{
public class ListsRemover
{
static void Main(string[] args)
{
List<string> countries = new List<string>() { "England", "Sweeden", "Uzbekistan", "London" };
countries.Remove("London");
Console.WriteLine(countries[0]);
Console.WriteLine(countries[1]);
Console.WriteLine(countries[2]);
}
}
}
Can anyone please help me to solve it?