The existing method doesn't require 3 arguments - it requires an Expression<Func<EcFieldWrapper, int, bool>>
because that's what you've declared your method to accept. That would be something like:
// This version ignores the index, but you could use it if you wanted to.
(value, index) => value.Name.ToUpper() == fieldName.ToUpper()
The index
would be the position within the collection, as you're calling this overload of Queryable.Where
.
Assuming you don't want the index, I strongly suspect you just want to change your FindBy
method to:
public EcFieldWrapper FindBy(Expression<Func<EcFieldWrapper, bool>> predicate)
{
return this.ListOfFields.Where(predicate).SingleOrDefault();
}
Or more simply, using the overload of SingleOrDefault
which accepts a predicate:
public EcFieldWrapper FindBy(Expression<Func<EcFieldWrapper, bool>> predicate)
{
return this.ListOfFields.SingleOrDefault(predicate);
}
That should work fine - and if it doesn't, you should tell us what happens when you try it.