I thought I was being pretty cool with this code:
IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator( ) {
Action<UnbalancedBinaryTree> yielder = null;
yielder = t => {
yielder(t.Left);
if (!t.IsEmpty)
yield return t.Value;
yielder(t.Right);
};
yielder(this);
}
But as it turns out (and I think I knew before, but had forgotten), C# doesn’t accept this. Not in 3.0 at least, and I think not in 4.0 either. Need to test. Meanwhile — why? Hm…