How to get only specific field from the list How to get only specific field from the list asp.net asp.net

How to get only specific field from the list


You can select the value you want first, like this:

filteredLessons.Select(l => l.lessonId).ToList();

And you'll get a list of ID's


If you want to get the the specific row value from list using linq use the following code:

var name = from r in objClientList           where r.ClientCode == Convert.ToInt32(drpClientsInternal.Items[i].Value)           select r.IsInternalClient;foreach (bool c in name){    if (c)    {        ClientNameInternal = ClientNameInternal + drpClientsInternal.Items[i].Text +", ";        drpClientsInternal.Items[i].Selected = true;    }}