Aggregate function in lambda


Aggregate function in lambda

  1. Create a console application and create a list of customers in it.
					var customerList = new List<Customer>()
        new Customer{CustomerCode=101,CustomerName = "Steve", TotalOrder = 2},
        new Customer{CustomerCode=102,CustomerName = "Mark", TotalOrder = 4},
        new Customer{CustomerCode=103,CustomerName = "Bill", TotalOrder = 7},
        new Customer{CustomerCode=104,CustomerName = "Dell",TotalOrder = 6}

2. Now with the help of the lambda expression we will get the summation of the total orders from the customer list.

					var sum = customerList.Sum(a => a.TotalOrder);

Please commecnt about how we can modify the post for better and please share the post so the dotnercoaching can be more accessable and you become a part of our mission to spread free knowledge to make a better future.


Leave your thought here

Your email address will not be published.


Free 10 Days

Master Course Invest On Self Now

Subscribe & Get Your Bonus!
Your infomation will never be shared with any third party