class Program
{
static void Main(string[] args)
{
while(true)
{
List<string> list1 = new List<string>();
Console.WriteLine("Please Enter First List");
String firstList = Console.ReadLine();
list1.Add(firstList);
List<String> list2 = new List<string>();
Console.WriteLine("Please Enter Second List");
string secondList = Console.ReadLine();
list2.Add(secondList);
var hashsetFirst = new HashSet<string>(list1);
var hashsetSecond = new HashSet<string>(list2);
bool compare = hashsetFirst.SetEquals(hashsetSecond);
if (compare == true)
{
Console.Write("Match List");
}
else
{
Console.Write("Unmatch List");
}
Console.ReadLine();
}
}
}
{
static void Main(string[] args)
{
while(true)
{
List<string> list1 = new List<string>();
Console.WriteLine("Please Enter First List");
String firstList = Console.ReadLine();
list1.Add(firstList);
List<String> list2 = new List<string>();
Console.WriteLine("Please Enter Second List");
string secondList = Console.ReadLine();
list2.Add(secondList);
var hashsetFirst = new HashSet<string>(list1);
var hashsetSecond = new HashSet<string>(list2);
bool compare = hashsetFirst.SetEquals(hashsetSecond);
if (compare == true)
{
Console.Write("Match List");
}
else
{
Console.Write("Unmatch List");
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment