Note that there are some explanatory texts on larger screens.

plurals
  1. POLINQ not accepting Contains()
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/374267/contains-workaround-using-linq-to-entities">&#39;Contains()&#39; workaround using Linq to Entities?</a> </p> </blockquote> <p>Using LINQ in C#, I have the following problem;</p> <p>I need to select rows from a big table, using 3 conditions: - "schooljaar" needs to be a value, set before, - "p_bamatype" needs to be a value NOT in a list defined in settings (this is a StringCollection) - "p_stdgeb" needs to be a value NOT in a list defined in settings (this is also a StringCollection)</p> <p>I have this code:</p> <pre><code>var set = (db.SA_Opleiding.Where(opleiding =&gt; opleiding.schooljaar == schooljaar &amp;&amp; !Properties.Settings.Default.Admin_Studiegebieden_Exclude.Cast &lt;string&gt;().ToList().Contains( opleiding.p_stdgeb.ToString()) &amp;&amp; !Properties.Settings.Default.Admin_Studietypes_Exclude.Cast &lt;string&gt;().ToList().Contains( opleiding.p_bamatype.ToString())) .Select(opleiding =&gt; new OpleidingModel() { Id = opleiding.p_opleiding, LanNames = new Dictionary &lt;string, string&gt;() { { "NL", opleiding. opleidingNL }, { "FR", opleiding. opleidingFR }, { "EN", opleiding. opleidingEN } } })) .ToList&lt;OpleidingModel&gt;(); return set; </code></pre> <p>However, LINQ fails converting the Contains method. I read about others having the same issue, but I can't seem to find a decent solution for this. Is there really any solution for the problem described? So what I exactly need is a NOT IN (collection of strings) LINQ equivalent.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload