I have some code that I am tasked with converting to C # from VB. My fragment seems that it cannot be converted from one to another, and if so, I just donβt know how to do it, and I'm a little upset.
Here is some background:
OrderForm- class abstractinherited Invoice(as well PurchaseOrder). The following VB snippet works correctly:
Dim Invs As List(Of OrderForm) = GetForms(theOrder.OrderID)
....
Dim inv As Invoice = Invs.Find(
Function(someInv As Invoice) thePO.SubPONumber = someInv.SubInvoiceNumber)
In C #, I came up with the best conversion:
List<OrderForm> Invs = GetForms(theOrder.OrderID);
....
Invoice inv = Invs.Find(
(Invoice someInv) => thePO.SubPONumber == someInv.SubInvoiceNumber);
However, when I do this, I get the following error:
Cannot convert lambda expression for delegation of type "System.Predicate" because parameter types do not match delegate parameter types
Is there a way to fix this without rebuilding my entire codebase?
source
share