/ Published in: C#
Expand |
Embed | Plain Text
using System; using System.Collections.Generic; using System.Text; namespace ArraysInCSharp { class Program { static void Main(string[] args) { SingleDim(); Console.WriteLine("++++++++++++++++++"); MultiDim(); } static void SingleDim() { foreach (string str in strCities) { Console.WriteLine(str); } } static void MultiDim() { { { "Houston", "TX" }, { "Austin", "TX" }, { "Tuscon", "AZ" }, { "Sedona", "AZ" } }; Console.WriteLine(strCityStates[0,0] + "," + strCityStates[0,1]); Console.WriteLine(strCityStates[1,0] + "," + strCityStates[1,1]); Console.WriteLine(strCityStates[2,0] + "," + strCityStates[2,1]); Console.WriteLine(strCityStates[3,0] + "," + strCityStates[3,1]); Console.WriteLine(" "); foreach (string str in strCityStates) { Console.WriteLine(str); } } } }
Comments
Subscribe to comments
You need to login to post a comment.

Does
foreach(string[] str in strCityStates) { Console.WriteLin(str[0] + "," + str[1]); }
work?
I would think it would, but I don't do C#...