using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { // Generate a 100 records using linq c# List<Employee> employees = Enumerable.Range(1, 100).Select(i => new Employee { Id = i, Name = "Employee " + i, Age = new Random().Next(22, 60), Department = i % 2 == 0 ? "IT" : "HR", Salary = new Random().Next(30000, 100000) }).ToList(); // Query 1: Get employees from IT department with salary > 50,000 var highSalaryITEmployees = employees .Where(e => e.Department == "IT" && e.Salary...
Comments
Post a Comment