public class Student { public int StudentID { get; set; } public string StudentName { get; set; } } public void GetStudent() { List<Student> obj = new List<Student>(); Student objStudent1 = new Student(); objStudent1.StudentID = 1; objStudent1.StudentName = "Test 1"; obj.Add(objStudent1); Student objStudent2 = new Student(); objStudent2.StudentID = 2; objStudent2.StudentName = "Test 1"; obj.Add(objStudent2); obj.ForEach(c => { if (c.StudentID == 1) { Console.Write("Student :" + c.StudentName); } }); }
This blog is only for C# Windows Aplication & Web Application & Other feature is css & jquery & Sql store procedure
Thursday, December 28, 2017
How to use Foreach Loop in LINQ
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment