Wednesday, 25 April 2007

Convert integer array to string array

Today I needed to write some code to convert an integer array to a string array. Somebody told me to iterate over the integer array and fill the string array.

I said to myself NO WAY. .NET has to have some build-in functionality to do this stuff. And it does. Array.Convert Generic Method is the name.

This is the code:

private void TestMethod(int[] intArray)
string[] stringArray =
new Converter<int,string>

string result = string.Join(",", stringArray);

private string ConvertIntToString(int intParameter)
return intParameter.ToString();

Greetz,                                                                              G


Post a Comment

Subscribe to Post Comments [Atom]

<< Home