namespace ConsoleApplication3 { class Program { static void Main(string[] args) { string[] stringArray = {"hey", "Tom"}; for (int i = 0; i < stringArray.Length; i++ ) { stringArray[i] += " dad"; Console.WriteLine(stringArray[i]); } Array.Resize(ref stringArray, stringArray.Length + 1); // Add bob to the last element of the array stringArray[stringArray.Length - 1] =" bob"; foreach (string s in stringArray) { string b = s + "sad"; Console.WriteLine(s); //Console.WriteLine(stringArray); } } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter