Thursday, 15 January 2015

Find csv data in column from list of data via linq -


In my table, my column stores a CSV list of items in C # I have a list of items and I I want to return a row to the column on all the rows which have any item from the list.

Table

  names | Tag  

with example data

  which can be used. Football, football, basketball mike | Hockey, Soccer Steve | Basketball, Baseball  

So if my C # list includes soccer and basketball, then whoever I take Steve back as he has one of his tag list.

Note, I am using the Entity Framework for the table.

brought you your unit data into memory:

var result = Players.toList (). Where (item = & gt; items.TAG.Split (','). Any (x => x.Contains ("basketball")

Update: Provide list of games

  list & lt; string & gt; game = new list & lt; string & gt; {"baseball", "basketball" , "Football"}; var results = player.ToList (). Where (item => items.TAG.Split (','). Any game (collection));  

No comments:

Post a Comment