add all elements in a list csharp

Code Example - add all elements in a list csharp

                
                        using System.Collections.Generic;
using System.Linq;

List<int> intList = new List<int>(){1, 2, 3, 4};
int sum = intList.Aggregate((x, y) => x + y);
                    
                
 

how to add to a list csharp

                        
                                var list = new List<string>();
list.Add("Hello");
                            
                        
 

csharp sum of list

                        
                                using System.Linq;
int my_sum = my_int_list.Sum();
                            
                        
 

csharp calculate sum of list

                        
                                double total = myList.Sum(item => item.Amount);
                            
                        
 

list sum csharp

                        
                                int total = monValues.Sum(x => Convert.ToInt32(x));