Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27353

VS 2008 Linq Where Clause with Sum

$
0
0
I have a List of CustomerAccount called AccountsList, in CustomerAccount are a few fields which two of them are AccountInvoiceType and AccountInvoiceTypeVal.

To get the total value of all the Invoices I use the following.

AllInvoicesTotal = AccountsList.Sum(Function(item As CustomerAccounts) item.AccountInvoiceTypeVal)

What I want to do is get the value of all the invoices but use a where clause to only count the AccountInvoiceType = "Credit"
I thought it would be something like the following.


AllInvoicesTotal = AccountsList.Sum(Function(item As CustomerAccounts) item.AccountInvoiceTypeVal Where item.AccountInvoiceType = "Credit")


Any Ideas ?

Thanks

Viewing all articles
Browse latest Browse all 27353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>