using System;
using System.Collections.Generic;
namespace ConsoleApplication_C_Sharp
{
class Program
{
static void Main(string[] args)
{
List<int> list = new List<int>();
list.Add(1);
list.Add(2);
list.Add(3);
list.Add(4);
list.Add(5);
try
{
list.Remove(2);
foreach (int n in list)
Console.WriteLine(n);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
/*
run:
1
3
4
5
*/