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

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

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -