Note that there are some explanatory texts on larger screens.

plurals
  1. POLinq Expression - Invalid Arguments
    primarykey
    data
    text
    <pre><code>public class EcImageWrapper { //etc... public IQueryable&lt;EcFieldWrapper&gt; ListOfFields { get { //logic here return this.listOfFields.AsQueryable(); } } public EcFieldWrapper FindBy(Expression&lt;Func&lt;EcFieldWrapper, int, bool&gt;&gt; predicate) { return this.ListOfFields.Where(predicate).SingleOrDefault(); } public EcFieldWrapper FindByName(string fieldName) { return this.FindBy(x =&gt; x.Name.ToUpper() == fieldName.ToUpper()); //error here, wanting 3 arguments //which makes sense as the above Expression has 3 //but i don't know how to get around this } </code></pre> <p>For some reason the Expression> Is requiring me to use 3 arguments, in the past I've only used 2 for the instance in question. However, now I'm wanting to do a find by on a collection within this instance.</p> <p>I'm getting the following errors:</p> <pre><code>Delegate 'System.Func&lt;MSDORCaptureUE.Wrappers.EcFieldWrapper,int,bool&gt;' does not take 1 arguments The best overloaded method match for 'CaptureUE.Wrappers.EcImageWrapper.FindBy(System.Linq.Expressions.Expression&lt;System.Func&lt;CaptureUE.Wrappers.EcFieldWrapper,int,bool&gt;&gt;)' has some invalid arguments Argument 1: cannot convert from 'string' to 'System.Linq.Expressions.Expression&lt;System.Func&lt;CaptureUE.Wrappers.EcFieldWrapper,int,bool&gt;&gt;' </code></pre> <p>Desired outcome: To be able to use a predicate of the return type EcFieldWrapper and predicate type of EcFieldWrapper within the instance of a class EcImageWrapper</p> <p>Why does it require 3? Why the int?</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