c# - Entity Framework Filtering with a List of String -
i want filter results according list of strings, this:
list<string> filters = {"a", "b", "c", "d"}; var results = (from r in db.entries r.word.startswith(filters[0]) ||r.word.startswith(filters[1]) ||r.word.startswith(filters[2]) ||...
i don't know length of filters list how query dynamically in linq?
thanks in advance.
this works little bit different in linq, kind of other way around
use .contains()
something this:
from r in db.entries filters.contains (r.word.substring(0,1))
Comments
Post a Comment