Selecting multiple columns in Linq

Total Post:45

Points:323
LINQ  Mvc 
 320  View(s)
Ratings:
Rate this:
objuser = from res in _db.users

              where (res.EMAIL == givenInfo || res.USER_NAME == givenInfo)
              select res.EMAIL;

How can I select multiple columns? 

  1. Post:52

    Points:366
    Re: Selecting multiple columns in Linq

    You can use like this

    var employee = _db.EMPLOYEEs
    
        .Where(x => x.EMAIL == givenInfo || x.USER_NAME == givenInfo)
        .Select(x => new { x.EMAIL, x.ID });

    Hope it helps you..

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!