Click here to Skip to main content
15,797,923 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
int[,] intArray=new string[dataGridView1.Rows.Count,dataGridView1.Columns.Count];

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

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

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

Try something like
stringArray = s1.Select(n => Convert.ToString(n)).ToArray();
Share this answer
Santhosh Kumar Jayaraman 6-Sep-12 2:02am    
+5. but inside lambda expression you can just say n.ToString() instead of convert.ToString(n)
Abhinav S 6-Sep-12 4:10am    
Convert.ToString is always a better option. In case n is null, tostring will throw an error.
Santhosh Kumar Jayaraman 6-Sep-12 4:25am    
Yes right.But i believe here we are trying to convert an integer tp string, there are no chances of having null as a value unless if its nullable int.
Abhinav S 6-Sep-12 8:08am    
That is correct.
private void TestMethod(int[] intArray)
   string[] stringArray =
   (intArray,new Converter<int,string>

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

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


or using Extensionmethod
string[] stringArray = intArray.Select(i => i.ToString()).ToArray():
Share this answer
ridoy 6-Sep-12 1:55am    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900