using System;
using System.Collections.Generic;
public class Lists
{
static void Main()
{
List <string> surfbreakList = new List<string> ();
surfbreakList.Add ("Mavericks");
surfbreakList.Add ("Teahupoo");
surfbreakList.Add ("Jaws");
surfbreakList.Add ("Nazare");
surfbreakList.Add ("Nahant Beach");
Console.WriteLine ("\nMy Favorite Surf Break List: ");
foreach (string surfbreak in surfbreakList)
{
Console.WriteLine ( surfbreak );
}
surfbreakList.Remove ("Nahant Beach");
surfbreakList.Insert (2, "Cocoa Beach");
Console.WriteLine ("\nAfter removing Nahant Beach and adding Cocoa Beach, the list is: ");
foreach (string surfbreak in surfbreakList)
{
Console.WriteLine ( surfbreak );
}
Console.WriteLine ("\nThe Index of Teahupoo is:");
Console.WriteLine(surfbreakList.IndexOf ("Teahupoo") );
// sort and print the list
surfbreakList.Sort ();
Console.WriteLine ("\nMy current surfing surf break list sorted is:");
foreach (string surfbreak in surfbreakList)
{
Console.WriteLine ( surfbreak );
}
// Cout the size of the list
Console.WriteLine("\nCount of breaks in the list is: " + surfbreakList.Count + "\n");
} // main
} // public class lists