using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; //csc List_RemoveRange1.cs namespace ConsoleApplication1 { class Program { static void Main(string[] args) { List eList = new List(); eList.Add("AD"); eList.Add("B"); eList.Add("AB"); eList.Add("C"); eList.Add("D"); eList.Add("AD"); eList.Add("E"); eList.Add("AD"); // eList.Sort(); Console.WriteLine("Reading List"); readT(eList); Console.WriteLine(" eList.RemoveRange(0,3);"); //eList.RemoveAll(s=>s =="AD"); eList.RemoveRange(0,3); readT(eList); Console.ReadLine(); } static void readT(IList list) { //notice that the list is passed an IList and hence can handle both types of lists //Use IEnumerable int n1 = 0; foreach (string val in list) { Console.WriteLine("index " + n1 + " string " + val); n1++; } } } }