Array.ConvertAll : Array ConvertAll : Data Structure C# Examples


C# Examples » Data Structure » Array ConvertAll »

 

Array.ConvertAll









    
using  System;
using  System.Collections;
using  System.Collections.Generic;
using  System.Collections.ObjectModel;
using  System.Text;


public  class  MainClass
{

        public  static  void  Main()
        {
                string[]  strArray  =  new  string[]  {  "75.3",  "25.999",  "105.25"  };

                double[]  doubleArray  =  Array.ConvertAll<string,  double>(strArray,  Convert.ToDouble);
                Console.Write("Converted  to  doubles:  ");
                Array.ForEach<double>(doubleArray,  delegate(double  x)  {  Console.Write(x  +  "  ");  });
                Console.WriteLine();
        }
}
    
   
  
   



Output

Converted to doubles: 75.3 25.999 105.25


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Structure
» Array ConvertAll