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[]  strArray2  =  new  string[]  {  "Blah",  "Foo",  "Canonical"  };
                Console.Write("Before  converting  to-upper:  ");
                Array.ForEach<string>(strArray2,  delegate(string  x)  {  Console.Write(x  +  "  ");  });
                Console.WriteLine();

                string[]  revArray  =  Array.ConvertAll<string,  string>(strArray2,  delegate(string  s)  {  return  s.ToUpper();  });
                Console.Write("Converted  to  upper-case:  ");
                Array.ForEach<string>(revArray,  delegate(string  x)  {  Console.Write(x  +  "  ");  });
                Console.WriteLine();
        }
}
    
   
  
   



Output

Before converting to-upper: Blah Foo Canonical
Converted to upper-case: BLAH FOO CANONICAL


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Structure
» Array ConvertAll