using System.Collections.Generic;
public static void Main()
var bigCities = new HashSet<string> ()
{ "New York", "Manchester", "Sheffield", "Paris" };
bool addedSheffield = bigCities.Add("Sheffield");
bool addedsheffield = bigCities.Add("sheffield");
bool addedBeijing = bigCities.Add("Beijing");
Console.WriteLine("Added Sheffield? " + addedSheffield);
Console.WriteLine("Added sheffield? " + addedsheffield);
Console.WriteLine("Added Beijing? " + addedBeijing);
foreach (string city in bigCities)
public static void setMethods(){
var bigCities = new HashSet<string>
{ "New York", "Manchester", "Sheffield", "Paris" };
{ "Sheffield", "Ripon", "Truro", "Manchester" };
var newCities = bigCities.Intersect(citiesInUk);
foreach (string city in newCities)
bigCities.IntersectWith(citiesInUk);
foreach (string city in bigCities)