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();
    }
}

你可能感兴趣的:(转换,String[],int[])