Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: .NET
Expertise: Intermediate
Sep 25, 2009

Convert a Delimited String to a Generic List<string>

This function separates the items in the delimited string (parameter 1) at the delimiter (parameter 2), creates a new generic string list, and then adds each item to the new list. Finally, it returns the filled list.

public static List<string> ConvertStringsToStringList(string items, char separator)
{
   List<string> list = new List<string>();
   string[] listItmes = items.Split(separator);
   foreach (string item in listItmes)
   {
      list.Add(item);
   }
   return list;
}
Srinath MS
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap