LINQ Statement for Generic List -


i have bool array , list:

bool[ ] searchable  list<t> alldata 

what want following

alldata.where(c => searchable[0] && c[0].contains("das") ||                    searchable[1] && c[1].contains("das") ||                    searchable[2] && c[2].contains("das")                    ...               ); 

how can construct linq function?

use this overload of where provides filtering callback index of element being considered along element itself:

var results = alldata.where((c, i) => searchable[i] && c.contains("das")); 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -