// Naomi Jones
// Survey, Summer 2025
// July 6, 2025
// Assignment 6 - 1 C# Lists
using System;
using System.Collections.Generic;
public class Opera
{
static void Main()
{
// Creates list to store opera names.
List <string> operaList = new List<string> ();
// Adds operas to the list.
operaList.Add ("Don Giovanni");
operaList.Add ("Un ballo in maschera");
operaList.Add ("Aida");
operaList.Add ("Der fliegende Hollander");
operaList.Add ("Gotterdammerung");
operaList.Add ("Turandot");
// Displays list of operas.
Console.WriteLine ("\nA list of favorite operas: ");
foreach (string opera in operaList)
{
Console.WriteLine ( opera );
}
operaList.Remove ("Gotterdammerung");
operaList.Insert (2, "Fidelio");
Console.WriteLine ("\nAfter removing Gotterdammerung and adding Fidelio, my list is: ");
foreach (string opera in operaList)
{
Console.WriteLine ( opera );
}
// Sort and prints the list.
operaList.Sort ();
Console.WriteLine ("\nMy current opera list sorted is:");
foreach (string opera in operaList)
{
Console.WriteLine ( opera );
}
} // main
} // class Opera