প্রথমে একটি স্ট্রিং অ্যরে সেট করুন।
string[] num = { "One", "Two", "Three", "Four", "Five"};
উপাদানগুলির গণনা পেতে Linq LongCount মেথডটি ব্যবহার করুন।
num.AsQueryable().LongCount();
সম্পূর্ণ কোডটি নিচে দেওয়া হলো −
উদাহরণ
using System;
using System.Collections.Generic;
using System.Linq;
class Demo {
static void Main() {
string[] num = { "One", "Two", "Three", "Four", "Five"};
long res = num.AsQueryable().LongCount();
Console.WriteLine("{0} উপাদান", res);
}
}
আউটপুট
৫ উপাদান