Where contains - query 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 = from s1 in set1
                    where set2.Contains(s1)
                    select s1;
		
		foreach (var i in results)
		{
			Console.WriteLine(i);
		}
	}
}
;