C# 实现 int[]到string[]的转换方法 Array.ConvertAll

using System;
using System.Collections.Generic;

//int[]到string[]的转换
public class Example
{
static void Main()
{
int[] int_array = { 1, 2, 3 };

string[] str_array = Array.ConvertAll(int_array, new Converter<int, string>(IntToString));

foreach (string s in str_array)
{
Console.WriteLine(s);
}
Console.Read();
}

public static string IntToString(int i)
{
return i.ToString();
}
}
posted @ 2008-04-18 23:52  vs.net  阅读(709)  评论(0)    收藏  举报