Where মেথডটি একটি প্রিডিকেটের ভিত্তিতে মানগুলির একটি অ্য্রে ফিল্টার করে।
এখানে, প্রিডিকেটটি ৭০-এর উপরের উপাদানগুলোর জন্য যাচাই করছে।
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);
// ৭০-এর উপরের উপাদানগুলো পাচ্ছি
IEnumerable myQuery = arr.AsQueryable().Where((n, index) => n >= 70);
Console.WriteLine("৭০-এর উপরের উপাদানগুলো...:");
foreach (int res in myQuery)
Console.WriteLine(res);
}
}
আউটপুট
অ্যরে: 10 30 20 15 90 85 40 75 ৭০-এর উপরের উপাদানগুলো...: 90 85 75