C# Program to Check the Salary of All Employees Is Less Than 10000 Using LINQ

Hi everyone do you know about C# Program to Check the Salary of All Employees Is Less Than 10000 Using LINQ. With this article, you can clearly see everything you have in doubt.

C# Program to Check the Salary of All Employees Is Less Than 10000 Using LINQ

C# Program to Check the Salary of All Employees Is Less Than 10000 Using LINQ

//C# program to check the salary of all employees 
//is less than 10000 using Linq.

using System;
using System.Linq;
using System.Collections.Generic;

public class Employee
{
    int ID;
    string Name;
    int Salary;
    string Department;

    static void Main(string[] args)
    {
        bool isLessthan = false;

        List<Employee> employees = new List<Employee>()
        {
             new Employee {ID=101,   Name="Amit  "    , Salary=4000,Department="ABC"},
             new Employee {ID=102,   Name="Amit  "    , Salary=3000,Department="XYZ"},
             new Employee {ID=103,   Name="Salman"    , Salary=3000,Department="ABC"},
             new Employee {ID=104,   Name="Ram   "    , Salary=2000,Department="XYZ"},
             new Employee {ID=105,   Name="Shyam "    , Salary=7000,Department="ABC"},
             new Employee {ID=106,   Name="Kishor"    , Salary=5000,Department="XYZ"},
        };

        isLessthan = employees.All(emp => emp.Salary < 10000);

        Console.WriteLine("The salary of all employees is less than 10000? " + isLessthan);
    }
}
The salary of all employees is less than 10000? True
Press any key to continue . . .

 Final Words

Through this article, we have come to know clearly that C# Program to Check the Salary of All Employees Is Less Than 10000 Using LINQ. If you have any doubts please leave a comment via the comment box.

Hi, I'm Selva a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment