Note that there are some explanatory texts on larger screens.

plurals
  1. POLosing "Order by" after additional .RemoveAll() with LINQ to ENTITIES (3.5)?
    primarykey
    data
    text
    <p>I seem to be needing to "re-order" my result set after i make some modifications to it, is this "a feature" if so, some enlightenment? am I missing something? </p> <pre><code>//need the "IN" type functionality to limit my initial set. var resultSet = from t in someContext.SomeEntities .Where("it.some_id IN{" + string.Join(",", array) + "}") where t.obj_id == objtId orderby t.tInt select new customObj { prop1= t.t1, prop2 = t.tInt, prop3 = t.tInt2 }; //Do some other lookups / decision branching and //determine that i need to remove the following: //just for arguments sake resultSet.ToList().RemoveAll(o =&gt; o.prop1== 8 &amp;&amp; o.prop1 == 5 &amp;&amp; o.prop1 == 11 &amp;&amp; o.prop1 == 21); foreach (var vals in resultSet) { //do something that depends on the order } </code></pre> <p>after that sequence.. something that i expected to be in order, is not.. when i do another orderby on the result set like:</p> <pre><code>foreach (var vals in resultSet.OrderBy(o =&gt; o.tInt)) { //now the order's okay } </code></pre> <p>then it's what i would've originally expected.. </p> <p>so should i not do any ordering until i have filtered my result set down? In this case obviously i could've done some filtering on the initial query, but in my situation, i really cant.. </p> <p>..thanks in advance. </p> <p>UPDATE:</p> <p>I must be doing a .ToList() on it for the (.RemoveAll()), is that the culprit then?</p> <p><a href="http://msdn.microsoft.com/en-us/library/wdka673a%28v=vs.90%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/wdka673a%28v=vs.90%29.aspx</a> </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.
    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