C# 数组类型转换 int[] 转换string[]

时间:2024-03-04 14:20:09
        private static string iii(long i) { return i.ToString(); }
        public static void Main(string[] args)
        {
            List<long> listtemp = new List<long>();
            listtemp.Add(1000);
            listtemp.Add(1000);
            listtemp.Add(1000);
            listtemp.Add(1000);
            string[] ttt = Array.ConvertAll(listtemp.ToArray(), new Converter<long, string>(iii));
            string[] bbb = Array.ConvertAll<long, string>(listtemp.ToArray(), delegate(long x) { return x.ToString(); });
            Console.WriteLine(string.Join(",", bbb));
            Console.Read();
         }