sammi taylor

sammi taylor

  • NA
  • 19
  • 0

search a list where id==id with linq C#

Apr 24 2015 1:11 PM
I am not sure how to do this. I want to do a search of a my SearchList where if records exists, give me back anything that has an Id. Not  using firstorDefault, or singleorDefault. I would like to use .Any or Contains...but I don't know how.
List<SearchBL> list = new List<SearchBL>(); DataTable dt;

Foreach (DataRow dr in dt.Rows)
{
SearchBL result = from item in list where  where item.ID == dr.Field<int>("ID") select item....

My datagridview populates with existing data if I filter my search with FirstorDefault. But it turns out I don't need that. Or

Any help is appreciated. Thanks!
 

Answers (1)