34
1
using System;
2
using System.Linq;
3
using System.Collections.Generic;
4
5
6
public class Program
7
{
8
public static void Main()
9
{
10
IList<Student> studentList = new List<Student>() {
11
new Student() { StudentID = 1, StudentName = "John", Age = 13 } ,
12
new Student() { StudentID = 2, StudentName = "Moin", Age = 21 },
13
new Student() { StudentID = 3, StudentName = "Bill", Age = 18 },
14
new Student() { StudentID = 4, StudentName = "Ram" , Age = 20 },
15
new Student() { StudentID = 5, StudentName = "Ron" , Age = 15 }
16
};
17
18
var totalStudents = studentList.Count();
19
20
Console.WriteLine("Total Students: {0}", totalStudents);
21
22
var adultStudents = studentList.Count(s => s.Age >= 18);
23
24
Console.WriteLine("Number of Adult Students: {0}", adultStudents );
25
26
}
27
}
28
29
public class Student{
30
31
public int StudentID { get; set; }
32
public string StudentName { get; set; }
33
public int Age { get; set; }
34
}
Cached Result
GENESISFLOW_ToFTempCalibrate
00-01-86-66
00-01-86-66