Tuple

いままで何故か用意されていなかったタプル。お陰で独自のPairやら、Tupleが沢山作られたと思います。

using System;

namespace TupleSample
{
    class Program
    {
        static void Main(string[] args)
        {
            // タプルの要素は7つ
            var t1 = Tuple.Create(1, 2, 3, 4, 5, 6, 7);

            // それ以上は他のタプルと結合
            var t2 = Tuple.Create(8, 9, 10, 11, 12, 13, 14, t1);

            // t2.Rest.Item1のItemXというのは、なんかイマイチな気が・・・
            Console.WriteLine("{0}, {1}", t2.Item7, t2.Rest.Item1.Item7);            
        }
    }
}

要素は7つまでで、それ以降はリンクリストのように他のタプルを指定するようです。ただ、最後の要素のネーミングがイマイチな気が。(^^;