The
Zip
overload which doesn't require a projection function was added in .NET Core 3.0. If you're using an earlier version of .NET Core, or if you're using .NET Framework, you have to provide a function which takes the two source elements and combines them into a single result element.
In this case, you just need to combine
Zip
and
Select
:
blSub.Text = lbDiscount.Items
.Zip(lbPrice.Items, (discount, price) => Convert.ToDecimal(discount) * Convert.ToDecimal(price))
.Sum()
.ToString();
Enumerable.Zip Method (System.Linq) | Microsoft Docs[
^]