Convert a int[] to string[]
August 7, 2007 @ 1:44 pm in Microsoft.Net 2.0
This morning I needed to convert an array of integers to strings and I stumbled across this nice little Array.ConvertAll generics method. My example is quite simple, but this technique could be used for much more complicated explicit casting.
1 2 3 4 5 6 7 | int[] values = new int[]{1,2,3,4,5}; string[] strValues = Array.ConvertAll(values, new Converter(IntToString)); .... public static string IntToString(int integer) { return integer.ToString(); } |

Tagged as 
