sum numbers from collection
Published: 9. October 2011 | Updated: 9. October 2011License: Microsoft Public License (MS-PL)
Categories: Collections » Linq, Framework » Math
Tags: C# Collections Linq Math
Import namespace
using System.Linq;
Code
int[] numbers = new[] { 5, 10, 30, 100 }; int sum = numbers.Sum(); Console.WriteLine(sum);Console Output:
145
| Send us feedback about this snippet » |





