Hello,
perhaps the following would work for you
List<string> mylist1 = new List<string>(new string[] { "element1", "element2", "element3" });
List<string> mylist2 = new List<string>(new string[] { "element1", "element3", "element0" });
var result1 = mylist1.Intersect(mylist2);
if (result1.Count() >0)
{
foreach (var item in result1)
{
Console.WriteLine(item);
}
}
Result
element1
element3
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.
No comments:
Post a Comment