0,1,0,1,0,1... を繰り返すシーケンス

using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static IEnumerable<int> ZeroOne() {
        int n = 0;
        while (true) {
            yield return n;
            n ^= 1;
        }
    }

    static void Main() {
        Console.WriteLine(string.Join(",", ZeroOne().Take(10)));
        // => 0,1,0,1,0,1,0,1,0,1
    }
}

実行結果です。

0,1,0,1,0,1,0,1,0,1