.NET, Archive, C#

Tail Recursion Revisited

A year ago I blogged about Tail Recursion in C# on .NET 2.0. With the public beta of .NET 3.5 now available, I decided to retry my little experiment.

For the experiment I used Beta 1 of .NET 3.5 (version 3.5.20404), which you can get from here. Using the supplied compiler, I compiled the following C# code:

public class TailTest{ public static void Main(){ TailTest f = new TailTest(); f.DoTail(0); } public void DoTail(int n){ int v = n + 1; System.Console.WriteLine(v); DoTail(v); } } read more