How to use LINQ to get the items that appear in both of two lists in C#? - Biz Tech

How to use LINQ to get the items that appear in both of two lists in C#?

Listen
 List<int> list1 = new List<int> { 1, 2, 3 };
List<int> list2 = new List<int> { 2, 3, 4 };
var commonNumbers = list1.Intersect(list2);

foreach (int number in commonNumbers)
{
    Console.WriteLine(number);
}