Where मेथड एक सरणी के मानों को एक प्रिडिकेट के आधार पर फ़िल्टर करता है।
यहाँ, प्रिडिकेट 70 से ऊपर के तत्वों की जांच कर रहा है।
Where((n, index) => n >= 70);
उदाहरण
using System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { int[] arr = { 10, 30, 20, 15, 90, 85, 40, 75 }; Console.WriteLine("सरणी:"); foreach (int a in arr) Console.WriteLine(a); // 70 से ऊपर के तत्व प्राप्त करना IEnumerable myQuery = arr.AsQueryable().Where((n, index) => n >= 70); Console.WriteLine("70 से ऊपर के तत्व...:"); foreach (int res in myQuery) Console.WriteLine(res); } }आउटपुट
सरणी: 10 30 20 15 90 85 40 75 70 से ऊपर के तत्व...: 90 85 75