We often use the following lambda expression
MyList.Select(x => x.Id).ToList();
Is possible to get more than 1 property usinglambda expression ? E.g Id
and Name
from MyList?
I know that I can use the following syntax:
(from item in MyList
select new { item.Id, item.Name }).ToList();
Can I do the same thing using lambda expression?
MyList.Select(x => new { x.Id, x.Name }).ToList();