using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
public partial class _Default : System.Web.UI.Page
{
class Employee
{
public int EmployeeId { get; set; }
public string EmployeeName { get; set; }
}
protected void Page_Load(object sender, EventArgs e)
{
List<Employee> lstEmployee = new List<Employee>();
Employee emp = new Employee();
emp.EmployeeId = 1;
emp.EmployeeName = "Name1";
lstEmployee.Add(emp);
emp = new Employee();
emp.EmployeeId = 2;
emp.EmployeeName = "Name2";
lstEmployee.Add(emp);
emp = new Employee();
emp.EmployeeId = 10;
emp.EmployeeName = "Name10";
lstEmployee.Add(emp);
//Below LINQ is used to get all the employee which is not having employee id 10
lstEmployee = lstEmployee.Where(x => x.EmployeeId != 10).ToList();
}
}
No comments:
Post a Comment