I have a List of strings that contain partial values, ie
var list = new List<string>{"A/B", "C/D"};
And in my DB I have records such as
- A/B/X
- X/C/V/B
- G/H/J
- C/D/D/C
- A/C
- A/B
So I would like to now query all the items from DB that start with any of values contained in list
. From the example 1, 4 and 6 should be returned.
I have other logic that is doing the same thing but other way around, so I can query like .Where(x => list.Contains(x))
, but can't figure out how to select values that start with items contained in list using LINQ.