Where contains - method syntax

CSharp · Console

/Program.cs

using System;
using System.Linq;
					
public class Program
{
	public static void Main()
	{
		int[] set1 = { 40, 10, 24, 60, 100, 55, 80, 75, 35 };
		int[] set2 = { 120, 110, 150, 160, 100, 155, 180, 175, 135 };
		
		var results = set1.Where(i => set2.Contains(i));
		
		 foreach (var i in results)
		 {
			 Console.WriteLine(i);
		 }

	}
}
;