// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.IO; namespace Logging { public static class Logging { public static bool log = false; public static TextWriter dbg = Console.Error; } public class Test { public static int Fac(int n) { int res; if (n <= 1) { res = 1; } else { res = n * Fac(n - 1); } Console.Error.WriteLine("fac : n = " + n + " res = " + res); return res; } public static void Main(string[] args) { Logging.log = true; Logging.dbg = Console.Error; Console.WriteLine(Fac(50)); } } }