using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
class
Employee{
int
id;
int
salary;
string
name;
string
department;
public
override
string
ToString()
{
return
id +
" "
+ name +
" "
+
salary +
" "
+ department;
}
static
void
Main(
string
[] args)
{
List<Employee> emp =
new
List<Employee>()
{
new
Employee{ id = 201, name =
"Druva"
,
salary = 12000, department =
"HR"
},
new
Employee{ id = 202, name =
"Deepu"
,
salary = 15000, department =
"Development"
},
new
Employee{ id = 203, name =
"Manoja"
,
salary = 13000, department =
"HR"
},
new
Employee{ id = 204, name =
"Sathwik"
,
salary = 12000, department =
"Designing"
},
new
Employee{ id = 205, name =
"Suraj"
,
salary = 15000, department =
"Development"
}
};
IEnumerable<Employee> result = emp.Where(x => x.name[0] ==
'D'
);
Console.WriteLine(
"ID Name Salary Department"
);
Console.WriteLine(
"++++++++++++++++++++++++++++"
);
foreach
(Employee e
in
result)
{
Console.WriteLine(e.ToString());
}
}
}