フィボナッチ数

 よくサンプルにされているため、IEnumerableを使うパフォーマンス的に普通のC# 2.0コードを書いてみました。

class Program {
	static void Main(string[] args) {
		int count = 0;
		foreach (ulong value in Fibonacci.Elements) {
			System.Console.WriteLine("({0:X016}) {0}", value);
			if (++count >= 90)
				break;
		}
	}
}
public static class Fibonacci {
	public static System.Collections.Generic.IEnumerable<ulong> Elements {
		get {
			ulong a = 1UL, b = 1UL;
			yield return a;
			yield return b;
			for (; ; ) {
				a += b;
				yield return a;
				b += a;
				yield return b;
			}
		}
	}
}