// 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; class MainClass { private const string CVAL = "abc"; static void gen(string s, int n) { if(s.Length == n) { Console.WriteLine(s); } else { for(int i = 0; i < CVAL.Length; i++) { gen(s + CVAL[i], n); } } } public static void Main(string[] args) { for(int i = 1; i <= 3; i++) { gen("", i); } } }