View Single Post
  #24 (permalink)  
Old 09-22-2007, 05:35 AM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 182
Balasubramanian.S is on a distinguished road
Default Re: C# .Net Tips & Tricks

Hi,

This is the easy way to convert a List<T>containing string data (Position types, e.g. Full-time, half-time, project appoint ment etc) to string[].

string[] bar = (string[])foo.ToArray (typeof(string));

Where foo is your List<string>

Ex:

List<string> li =new List<string>();

li.Add("Test");
li.Add("Test1");

li.Add("Test2");
li.Add("Test3");

string[] si = li.ToArray();

Response.Write(si[0]);

Thanks..

S.Balasubramanian..
Reply With Quote