Skip to content

Instantly share code, notes, and snippets.

@Lahirutech
Last active May 26, 2021 17:30
Show Gist options
  • Save Lahirutech/64f8e736a776f73c03ca53dfdefbb0b2 to your computer and use it in GitHub Desktop.
Save Lahirutech/64f8e736a776f73c03ca53dfdefbb0b2 to your computer and use it in GitHub Desktop.
var students = new List<Student>() {
new Student(){ Id = 1, Name="Bill"},
new Student(){ Id = 2, Name="Steve"},
new Student(){ Id = 3, Name="Ram"},
new Student(){ Id = 4, Name="Abdul"}
};
//get all students whose name is Bill
var result = from s in students
where s.Name == "Bill"
select s;
foreach(var student in result)
Console.WriteLine(student.Id + ", " + student.Name);
/*
1, Bill
5, Bill
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment