「C#入門」Insert()で要素を追加するサンプル
サンプルコード
using System;
using System.Collections.Generic;
namespace InsertDemo
{
class Sample
{
static void Main()
{
var ct = new List<string>();
ct.Add("渋谷");
ct.Add("品川");
ct.Add("目黒");
ct.Add("大崎");
ct.Insert(1, "新宿");
Console.WriteLine("[{0}]", string.Join(", ", ct));
Console.ReadKey();
}
}
}