[C#][Tips] List 宣言・インスタンス・初期値


//**********************************************
///
/// [LIST] 宣言・インスタンス・初期値
/// 
//**********************************************
public static void mList_Init()
{

    //==========================
    /* 宣言 */
    //==========================
     List<int> ilList;

    //==========================
    /* インスタンス */
    //==========================
    ilList = new List();
    ilList = new List(new int[3]);

    //==========================
    /* 初期値 */
    //==========================
    ilList = new List(new int[3]) { 1, 2, 3 };
    ilList = new List() { 1, 2, 3 };

    ilList.ForEach(c => Console.Write(c + " : "));
    Console.WriteLine();

    ilList = new List(Enumerable.Repeat(9, 15));
    ilList.ForEach(c => Console.Write(c + " : "));
    Console.WriteLine();

}