[C#]ArrayList

ArrayListってよく使うのに、http://www.microsoft.com/japan/msdn/library/default.asp?url=/japan/msdn/library/ja/cpref/html/frlrfsystemcollectionsarraylistclasstopic.asp のサンプルを見ると、データ格納するのに、Add メソッド使わなあかんのかいなぁ、と思ったのだが、初期化時にデータをちゃんとセットできる。

たとえばこんなカンジ


System.Collections.ArrayList myAR = new System.Collections.ArrayList(new int[] {1,2,3,4,5});

Hashtableと組み合わせて、キーに対応する配列を値としてセットする時は、


System.Collections.Hashtable myHT = new System.Collections.Hashtable();
myHT.Add("key", new System.Collections.ArrayList(new int[] {1,2,3,4,5}) );