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(); } }
Before converting to-upper: Blah Foo Canonical Converted to upper-case: BLAH FOO CANONICAL