Tuesday, April 14, 2009

How to use Foreach in c# Arrays

string[] WeeKdays = new string[7];

WeeKdays[0] = Sunday";
WeeKdays[1] = "Monday";
WeeKdays[2] = "Tuesday";
WeeKdays[3] = "Wednesday";
WeeKdays[4] = "Thursday";
WeeKdays[5] = "Friday";
WeeKdays[6] = "Saturday";

foreach (object row in Weekdays)
{
Response.Write(row + " , ");
}

No comments: