using System.Collections.Generic;
public static string[] FindCommon(string[] names1, string[] names2)
HashSet<string> hSet1 = new HashSet<string>(names1);
HashSet<string> hSet2 = new HashSet<string>(names2);
String[] stringArray = new String[hSet1.Count];
hSet1.CopyTo(stringArray);
public static void Main(string[] args)
string[] names1 = new string[] {"Ava", "Emma", "Olivia"};
string[] names2 = new string[] {"Olivia", "Sophia", "Emma"};
Console.WriteLine(string.Join(", ", Names.FindCommon(names1, names2)));