I have a list of objects. One property of the individual object entry is amount. How do I get the sum of amount?
If my list was of type double I may be able to do something like this:
double total = myList.Sum();
However I want to something similar to this, yet this syntax is incorrect.
double total = myList.amount.Sum();
How should I go about accomplishing this? I would love to use the Sum function if possible instead of looping through and calculating the value.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…