c# - lambda search in combined string -


here table data ,

 areas                           cities ============================================================== area1                   city1 , city2 , city3 , city4 area2                   city5 , city6 , city7 , city8 area3                   city9 , city10 , city11 , city12 area4                   city13 , city14 , city15 , city16 

if give value city1 , want area1 .
(eg. city7 => area2 , city14 => area4) .
there short way using lambra expression ?

try code:

yourdatatable.first(x => x.cities.split(',').any(y => y.trim() == "city1")) 

where search term string city 1


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -