将整数数组转换为字符串数组

将整数数组转换为字符串数组

本文介绍了将整数数组转换为字符串数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int[,] intArray=new string[dataGridView1.Rows.Count,dataGridView1.Columns.Count];


--------其中dataGridView1.rows = 5048576和column.count = 21

--------我想将intArray转换为字符串数组.

string [,] stringArray = ???(如何在intArray上转换?????


--------where dataGridView1.rows=5048576 and columns.count=21

--------i want to convert intArray to string array.

string[,] stringArray=???(how to convert above intArray?????

推荐答案

stringArray = s1.Select(n => Convert.ToString(n)).ToArray();


private void TestMethod(int[] intArray)
{
   string[] stringArray =
   Array.ConvertAll<int,string>
   (intArray,new Converter<int,string>
   (ConvertIntToString));

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

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




来源: http://gsharper.blogspot.in/2007/04/convert-integer-array-to-string-array.html [ ^ ]

或使用Extensionmethod




Source:http://gsharper.blogspot.in/2007/04/convert-integer-array-to-string-array.html[^]

or using Extensionmethod

string[] stringArray = intArray.Select(i => i.ToString()).ToArray():


这篇关于将整数数组转换为字符串数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 07:45