c# - How to get sum of the values from List?

后端 未结 4 1764
清酒与你
清酒与你 2021-01-03 20:22

I want to get sum of the values from list.

For example: I have 4 values in list 1 2 3 4 I want to sum these values and display it in Label

Code:



        
4条回答
  •  孤街浪徒
    2021-01-03 20:53

    How about this?

    List monValues = Application["mondayValues"] as List;
    int sum = monValues.ConvertAll(Convert.ToInt32).Sum();
    

提交回复
热议问题