Overriding the ToString method in arrays

Grr, it’s annoying that the ToString() method can’t be overridden for arrays, and since the System.Array class can’t be derived from, we’re forced to rely on helper methods to convert arrays (or collections) into strings.

public static string ConvertCollectionToString(IList Collection)
System.Text.StringBuilder SB = new System.Text.StringBuilder();
for (int i = 0; i

This helper function will take an array and convert it to a comma-delimited string. Eg. an array with three elements: apple, pear and banana will be converted to the string apple, pear, banana.

This entry was posted in Uncategorized by Mun. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *