একটি অ্যারেতে উপাদানগুলো মডিফাই করতে Select পদ্ধতি ব্যবহার করুন।
নিচে আমাদের স্ট্রিং অ্যারেটি দেওয়া হলো।
string[] stationery = { "diary", "board", "pencil", "whiteboard" };Select পদ্ধতিও নিচে দেখানো মতো ল্যাম্বডা এক্সপ্রেশন নির্দিষ্ট করে -
উদাহরণ
using System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { string[] stationery = { "diary", "board", "pencil", "whiteboard" }; var res = stationery.AsQueryable().Select((item, index) => new { result = item.Substring(0, index + 4) }); foreach (var str in res) { Console.WriteLine("{0}", str); } } }আউটপুট
{ result = diar } { result = board } { result = pencil } { result = whitebo }