select ক্লজে into অপারেটর ব্যবহার করে কোয়েরি সেট করুন।
নিচে Employee বিবরণ সহ আমাদের লিস্ট দেওয়া হল:
IListemployee = new List () { new Employee() { EmpID = 1, EmpName = "Tom", EmpMarks = 90, Rank = 8} , new Employee() { EmpID = 2, EmpName = "Anne", EmpMarks = 60, Rank = 21 } , new Employee() { EmpID = 3, EmpName = "Jack", EmpMarks = 76, Rank = 18 } , new Employee() { EmpID = 4, EmpName = "Amy" , EmpMarks = 67, Rank = 20} , };
এখন, into অপারেটর ব্যবহার করে কর্মচারির নাম আনুন যা k দিয়ে শেষ হয় এবং র্যাঙ্ক <20 এবং >5।
var res = from e in employee where e.Rank > 5 where e.Rank < 20 select e into name where name.EmpName.EndsWith("k") select name;
সম্পূর্ণ কোডটি দেখি।
উদাহরণ
using System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { IList employee = new List() { new Employee() { EmpID = 1, EmpName = "Tom", EmpMarks = 90, Rank = 8} , new Employee() { EmpID = 2, EmpName = "Anne", EmpMarks = 60, Rank = 21 } , new Employee() { EmpID = 3, EmpName = "Jack", EmpMarks = 76, Rank = 18 } , new Employee() { EmpID = 4, EmpName = "Amy" , EmpMarks = 67, Rank = 20} , }; // k দিয়ে শেষ হওয়া কর্মচারির নাম আনুন এবং র্যাঙ্ক <20 এবং >5 var res = from e in employee where e.Rank > 5 where e.Rank < 20 select e into name where name.EmpName.EndsWith("k") select name; foreach (var emp in res) { Console.WriteLine("Name: " + emp.EmpName); Console.WriteLine("Marks: " + emp.EmpMarks); } } } public class Employee { public int EmpID { get; set; } public string EmpName { get; set; } public int EmpMarks { get; set; } public int Rank { get; set; } }
আউটপুট
Name: Jack Marks: 76