Conversion List<string> to string[]

Tag:[C#] [List] [Generics]
List <string> from string[] If you convert ToArray() method can be used.
   private void button1_Click(object sender, EventArgs e)
   {
     List<string> lst = new List<string>();
     lst.Add("aaa");
     lst.Add("bbb");
     lst.Add("ccc");

     string[] strlst = lst.ToArray();
   }

string[] When you convert from List<string>. List<string> constructor string[] Pass.
   private void button1_Click(object sender, EventArgs e)
   {
     string[] lst = {"AAA","BBB","CCC"};
     
     List<string> genlist = new List<string>(lst);
   }

Register date :2011-10-16    Last update :2017-01-17
Tag:[C#] [List] [Generics]
JapaneseEnglish
プライバシー    iPentecについて
iPentec all rights reserverd. (ISDC)