तत्वों की संख्या प्राप्त करने के लिए लिंक लॉन्गकाउंट विधि का उपयोग करें।
हमारा स्ट्रिंग ऐरे निम्नलिखित है -
string[] emp = { "Jack", "Mark"}; अब, LongCount() विधि का उपयोग करें।
emp.AsQueryable().LongCount();
यहाँ पूरा कोड है।
उदाहरण
using System;
using System.Collections.Generic;
using System.Linq;
class Demo {
static void Main() {
string[] emp = { "Jack", "Mark"};
long res = emp.AsQueryable().LongCount();
Console.WriteLine("{0} employees in the Department", res);
}
} आउटपुट
2 employees in the Department