// 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("Fidelio");
operaList.Add("Turandot");
// Decided that Gotterdammerung should be on the list instead of Fidelio.
operaList.Remove("Fidelio");
operaList.Insert(5, "Gotterdammerung");
// Sorting the list.
operaList.Sort();
// Displays list of operas.
Console.WriteLine("A list of favorite operas: ");
foreach (string opera in operaList)
{
Console.WriteLine(opera);
}
// Checking if these operas are contained in the list.
Console.WriteLine("\nChecking if these operas are contained in the list: ");
Console.WriteLine("Carmen: " + operaList.Contains("Carmen"));
Console.WriteLine("La Boheme: " + operaList.Contains("La Boheme"));
Console.WriteLine("Don Giovanni: " + operaList.Contains("Don Giovanni"));
} // main
} // class Opera