Possible Duplicate:
check whether a List<string> contains an element in another List<string> using LINQ
A SQL database column stores a bunch of strings like so: /String1/String2/String3/… with the first and last characters being ‘/’. I need to compare this column to a List<string> to decide whether a parameter string in the list is contained in the column value.
Column value: “/One/Two/Three/Four/”
Parameter: List<string> parameters = new List<string>{"Two", "Three"};
Compare the parameter list to the column value. Since at least one item appears in the column value, return true / select the row.
I’m using LINQ-to-SQL.
Use String.Split Method, Enumerable.Intersect Method and Enumerable.Any Method: