// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public class Program { public static void Main(string[] args) { int[][] a = { new int[] { 1 }, new int[] { 2 }, new int[] { 3 } }; int atmp = 0; for(int i = 0; i < a.Length; i++) { a[i][0] += atmp; atmp = a[i][0]; } for(int i = 0; i < a.Length; i++) { Console.WriteLine(a[i][0]); } int[][] b = { new int[] { 1 }, new int[] { 2 }, new int[] { 3 } }; int btmp = 0; foreach(int[] v in b) { v[0] += btmp; btmp = v[0]; } foreach(int[] v in b) { Console.WriteLine(v[0]); } } } }