Skip to content

Array Conversion

Don Kapevic

Asked Apr 4, 2015, 8:34 AM EDT3 answers
Share
LinkedInX
How do I convert a 2d string array to 2d decimal array in c# ?
I have tried using 'Array.ConvertAll' but this is throwing an error..

decimal[,]myReadData=new decimal[6,5];
string[,]myData=new string[6,5];

myReadData = Array.ConvertAll<string, decimal>(myData, Convert.ToDecimal);

Does 'Array.ConvertAll' only work with 1d arrays ?


Thanks in advance

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Gowtham Rajamanickam
    0
    http://www.functionx.com/csharp2/arrays/Lesson02b.htm follow the link which i have shared to you...
    0
  • 0
    Thank you for the link but I have used a nested 'for' loop to convert each element with 'System.Convert.ToDecimal' and it is working fine now..
    0
  • 0
    Thank you for the link but I have used a nested 'for' loop to convert each element with 'System.Convert.ToDecimal' and it is working fine now..
    0