ASP.NET - convert it to array - Asked By mostafa hamdy on 13-Mar-11 11:29 AM

Hello all
I have some string in the following format "aa,dd,ff,ggg,yy" and I want to convert this string to array of strings or list
please if any body get what I mean and can help me please send me or tell me about some URL may help me in doing that
Mash B replied to mostafa hamdy on 13-Mar-11 11:47 AM
string strValue = "aa,dd,ff,ggg,yy";
// To convert to string array use Split function of string
string[] arrValue = strValue.Split(new char[] { ',' });

Kirtan Patel replied to mostafa hamdy on 13-Mar-11 12:59 PM
here is how you can do it

Converting your String into Array of String
 string str = "aa,dd,ff,ggg,yy";
/* Convert to Array */
 string[] StringArr = str.Split(',');

Converting your String into List<T> object

/* Convert to List<t> */
string str = "aa,dd,ff,ggg,yy";
List<string> ListObject = str.Split(',').ToList<string>();