CSharp examples for System.Collections.Generic:IList
Sums the specified list.
using System.Collections.Generic; using System.Collections; using System;// w ww . j a va2 s . c om public class Main{ /// <summary> /// Sums the specified list. /// </summary> /// <param name="list">The list.</param> /// <returns></returns> public static int Sum(IList<int> list) { int sum = 0; foreach (int n in list) { sum += n; } return sum; } }