lundi 25 avril 2016

How to use where clause in LINQ to display specific row?

I need to display only the specific row from the xml ,specific to the email id of the employee.

By this piece of code i'm returning the list of all the employees.

List employees = new List();

            employees = (from rows in ds.Tables[0].AsEnumerable()

                         select new Employee
                         {
                             EmployeeID = rows[0].ToString(),
                             Name = rows[1].ToString(),
                             Email = rows[2].ToString(),
                             DateOfBirth = rows[3].ToString(),
                             Country = rows[4].ToString(),
                             ContactNo = rows[5].ToString(),
                             EmployeeType = rows[6].ToString(),
                             Password = rows[7].ToString(),
                             ConfirmPassword = rows[8].ToString(),
                         }).ToList();
            return employees;

how do i put a where condition that should check the xml email node and display the respective row. Please HELP!

Aucun commentaire:

Enregistrer un commentaire