Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is because C# supports <a href="http://en.wikipedia.org/wiki/Closure_%28computer_science%29" rel="nofollow">closures</a>. The compiler is complaining because the lambda parameter <code>myList</code> must have a different name than any variables in the outer scope. </p> <p>Try this:</p> <pre><code>myList = myList.Where(x =&gt; x.ProductionOrderNo.ToUpper().Contains(SearchString.ToUpper())); </code></pre> <p>See <a href="http://msdn.microsoft.com/en-us/library/bb397687.aspx" rel="nofollow">Lambda Expressions (C# Programming Guide)</a></p> <hr> <p>The next issue you have is that <code>myList</code> is of type <code>ProductionOrderList</code> while <code>Where</code> retuns an <code>IEnumerable&lt;T&gt;</code>. Unless you <em>need</em> to use a custom collection type, I wouldn't use it. Try this:</p> <pre><code> IEnumerable&lt;tionOrderItem&gt; myList = ProductionOrderReg.GetProductionOrders(...); if (!string.IsNullOrEmpty(SearchString)) { // here on myList get red line myList = myList.Where(x =&gt; x .ProductionOrderNo.ToUpper().Contains(SearchString.ToUpper())); } ... </code></pre> <p>Or, you really <em>must</em> use an instance of <code>ProductionOrderList</code>, make sure you have a constructor that takes an <code>IEnumerable&lt;T&gt;</code>, and use this:</p> <pre><code> ProductionOrderList myList = ProductionOrderReg.GetProductionOrders(...); if (!string.IsNullOrEmpty(SearchString)) { // here on myList get red line myList = new ProductionOrderList( myList.Where(x =&gt; x .ProductionOrderNo.ToUpper().Contains(SearchString.ToUpper()))); } </code></pre>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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