HOW TO SUM A FIELD IN A LIST

Chintoo Semi

Total Post:135

Points:947
Posted by  Chintoo Semi
VB.Net 
 1213  View(s)
Ratings:
Rate this:

I have:

 Dim aList As List(Of myObj.Answers) = myObj.GetResults(someID)

How can I get the sum of aList.AnswerCount field in my List(Of myObj) ?

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: How to sum a field in a List

    Hi Chintoo, 


    try this:

    aList.Sum(Function(i) i.AnswerCount)

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!