Little sample:
using System;
using System.Collections.Generic;
public class Test {
public static void Main ()
{
Collection <int> c = new Collection <int> ();
c.Add (3);
c.Add (5);
c.Add (11);
// Note that unboxing is not neccessary
int sum = 0;
for (int i = 0; i < c.Count; i++)
sum += c [i];
Console.WriteLine (sum);
}
}
Compile with gmcs. Enjoy.
2 comentarios:
Publicar un comentario