↑ Grab this Headline Animator

Monday, May 12, 2008

What is StringCollection?

StringCollection is a simple resizable collection of strings

Following function shows how to insert and retrive data into/from StringCollection.

public static string GetStringCollection()
System.Text.StringBuilder strB = new System.Text.StringBuilder();
// Add strings into StringCollection
System.Collections.Specialized.StringCollection strC = new System.Collections.Specialized.StringCollection();
strC.Add("Ram 1");
strC.Add("Ram 2");
strC.Add("Ram 3");
strC.Add("Ram 4");
strC.Add("Ram 5");

// Retrieve string from StringCollection
System.Collections.Specialized.StringEnumerator coll = strC.GetEnumerator();
while (coll.MoveNext())
strB.Append(coll.Current + "");
return strB.ToString();

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.


Latest Articles