33
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
5
namespace ConsoleApplication1
6
{
7
internal class Student
8
{
9
public int ID { get; set; }
10
public string Name { get; set; }
11
public bool IsFeesSubmitted { get; set; }
12
}
13
14
public class Program
15
{
16
public static void Main(string[] args)
17
{
18
List<Student> students = new List<Student>();
19
20
students.Add(new Student { ID = 1, Name = "Asutosh", IsFeesSubmitted = true });
21
students.Add(new Student { ID = 1, Name = "Kapil", IsFeesSubmitted = true });
22
students.Add(new Student { ID = 1, Name = "Sumit", IsFeesSubmitted = true });
23
students.Add(new Student { ID = 1, Name = "Rajat", IsFeesSubmitted = false });
24
students.Add(new Student { ID = 1, Name = "Preeti", IsFeesSubmitted = true });
25
students.Add(new Student { ID = 1, Name = "Kanupriya", IsFeesSubmitted = true });
26
27
//check whether all students submitted their fees or not
28
bool areAllStudentsSubmitTheirFees = students.All(student => student.IsFeesSubmitted == true);
29
30
Console.WriteLine(areAllStudentsSubmitTheirFees);
31
}
32
}
33
}
Cached Result