On the click of the button I’m writing this:
protected void Button1_Click(object sender, EventArgs e)
{
List<Students> student = new List<Students>()
{
new Students {FirstName= "Ram", LastName= "Gol"},
new Students {FirstName= "Ran", LastName= "Gom"},
new Students {FirstName= "Rao", LastName= "Gon"},
new Students {FirstName= "Rap", LastName= "Goo"}
};
IEnumerable<Students> empQuery = from s in student
where s.FirstName.Length ==3
select s.FirstName;
foreach (var stud in empQuery)
{
Button1.Text = stud;
}
And I’m using System.Collection.Generic also. But I’m getting error of
the type or namespace name ‘Students’ could not be found (are you
missing a using directive or an assembly reference?)
Please let me know what I’m doing wrong.
1 Answer